Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
803f676361
|
@ -13,7 +13,6 @@
|
|||
|
||||
from keystoneauth1 import exceptions as keystone_exceptions
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine.clients.os import keystone
|
||||
|
@ -299,7 +298,7 @@ class KeystoneClientPluginServiceTest(common.HeatTestCase):
|
|||
msg = ("Keystone has more than one service with same name "
|
||||
"%s. Please use service id instead of name" %
|
||||
self.sample_name)
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.services.get,
|
||||
self.sample_name)
|
||||
|
@ -323,7 +322,7 @@ class KeystoneClientPluginServiceTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ("The KeystoneService (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.services.get,
|
||||
self.sample_name)
|
||||
|
@ -427,7 +426,7 @@ class KeystoneClientPluginRoleTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ("The KeystoneRole (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.roles.get,
|
||||
self.sample_name)
|
||||
|
@ -451,7 +450,7 @@ class KeystoneClientPluginRoleTest(common.HeatTestCase):
|
|||
self.sample_name_and_domain)
|
||||
msg = ("The KeystoneRole (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.roles.get,
|
||||
self.sample_name)
|
||||
|
@ -570,7 +569,7 @@ class KeystoneClientPluginProjectTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ("The KeystoneProject (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.projects.get,
|
||||
self.sample_name)
|
||||
|
@ -593,7 +592,7 @@ class KeystoneClientPluginProjectTest(common.HeatTestCase):
|
|||
self.sample_name_and_domain)
|
||||
msg = ("The KeystoneProject (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.projects.get,
|
||||
self.sample_name)
|
||||
|
@ -685,7 +684,7 @@ class KeystoneClientPluginDomainTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ("The KeystoneDomain (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.domains.get,
|
||||
self.sample_name)
|
||||
|
@ -789,7 +788,7 @@ class KeystoneClientPluginGroupTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ("The KeystoneGroup (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.groups.get,
|
||||
self.sample_name)
|
||||
|
@ -813,7 +812,7 @@ class KeystoneClientPluginGroupTest(common.HeatTestCase):
|
|||
self.sample_name_and_domain)
|
||||
msg = ("The KeystoneGroup (%(name)s) could not be found." %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.groups.get,
|
||||
self.sample_name)
|
||||
|
@ -924,7 +923,7 @@ class KeystoneClientPluginUserTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ('The KeystoneUser (%(name)s) could not be found.' %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self.assertRaises(keystone_exceptions.NotFound,
|
||||
self._client.client.users.get,
|
||||
self.sample_name)
|
||||
|
@ -990,4 +989,4 @@ class KeystoneClientPluginRegionTest(common.HeatTestCase):
|
|||
self.sample_name)
|
||||
msg = ('The KeystoneRegion (%(name)s) could not be found.' %
|
||||
{'name': self.sample_name})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception as heat_exception
|
||||
from heat.engine.clients.os import monasca as client_plugin
|
||||
|
@ -94,6 +93,6 @@ class MonascaClientPluginNotificationTest(common.HeatTestCase):
|
|||
self.sample_uuid)
|
||||
msg = ("The Monasca Notification (%(name)s) could not be found." %
|
||||
{'name': self.sample_uuid})
|
||||
self.assertEqual(msg, six.text_type(ex))
|
||||
self.assertEqual(msg, str(ex))
|
||||
self._client.notifications.get.assert_called_once_with(
|
||||
notification_id=self.sample_uuid)
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
import mock
|
||||
from neutronclient.common import exceptions as qe
|
||||
|
||||
|
@ -169,7 +167,7 @@ class NeutronConstraintsValidate(common.HeatTestCase):
|
|||
)
|
||||
expected = ("The neutron extension (%s) could not be found." %
|
||||
constraint.extension)
|
||||
self.assertEqual(expected, six.text_type(ex))
|
||||
self.assertEqual(expected, str(ex))
|
||||
self.assertTrue(constraint.validate("foo", ctx))
|
||||
self.assertFalse(constraint.validate("bar", ctx))
|
||||
mock_find.assert_has_calls(
|
||||
|
|
|
@ -21,7 +21,6 @@ from novaclient import exceptions as nova_exceptions
|
|||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils as json
|
||||
import requests
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine.clients.os import nova
|
||||
|
@ -474,7 +473,7 @@ class NovaClientPluginMetadataTest(NovaClientPluginTestCase):
|
|||
"""Prove that the user can only pass in a dict to nova metadata."""
|
||||
excp = self.assertRaises(exception.StackValidationFailed,
|
||||
self.nova_plugin.meta_serialize, "foo")
|
||||
self.assertIn('metadata needs to be a Map', six.text_type(excp))
|
||||
self.assertIn('metadata needs to be a Map', str(excp))
|
||||
|
||||
def test_serialize_combined(self):
|
||||
original = {
|
||||
|
|
|
@ -15,7 +15,6 @@ import uuid
|
|||
|
||||
import mock
|
||||
from saharaclient.api import base as sahara_base
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine.clients.os import sahara
|
||||
|
@ -86,7 +85,7 @@ class SaharaUtilsTest(common.HeatTestCase):
|
|||
e = self.assertRaises(exception.Error,
|
||||
self.sahara_plugin.find_resource_by_name,
|
||||
'images', img_name)
|
||||
self.assertEqual(expected_error, six.text_type(e))
|
||||
self.assertEqual(expected_error, str(e))
|
||||
|
||||
self.sahara_client.images.find.assert_called_once_with(name=img_name)
|
||||
|
||||
|
@ -152,7 +151,7 @@ class SaharaUtilsTest(common.HeatTestCase):
|
|||
plugin_name, '1.2.3')
|
||||
self.assertEqual("Requested plugin 'vanilla' doesn't support version "
|
||||
"'1.2.3'. Allowed versions are 1.2.1, 2.6.0, 2.7.1",
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
calls = [mock.call(plugin_name), mock.call(plugin_name)]
|
||||
self.sahara_client.plugins.get.assert_has_calls(calls)
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.engine.constraint import common_constraints as cc
|
||||
from heat.tests import common
|
||||
|
@ -257,7 +256,7 @@ class CRONExpressionConstraint(common.HeatTestCase):
|
|||
"is not acceptable, out of range") % cron_expression
|
||||
self.assertFalse(self.constraint.validate(cron_expression, self.ctx))
|
||||
self.assertEqual(expect,
|
||||
six.text_type(self.constraint._error_message))
|
||||
str(self.constraint._error_message))
|
||||
|
||||
def test_validation_columns_length_error(self):
|
||||
cron_expression = "* *"
|
||||
|
@ -266,7 +265,7 @@ class CRONExpressionConstraint(common.HeatTestCase):
|
|||
"iteratorexpression.")
|
||||
self.assertFalse(self.constraint.validate(cron_expression, self.ctx))
|
||||
self.assertEqual(expect,
|
||||
six.text_type(self.constraint._error_message))
|
||||
str(self.constraint._error_message))
|
||||
|
||||
|
||||
class TimezoneConstraintTest(common.HeatTestCase):
|
||||
|
@ -286,7 +285,7 @@ class TimezoneConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(timezone, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_none(self):
|
||||
|
@ -312,7 +311,7 @@ class DNSNameConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_name, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_error_empty_component(self):
|
||||
|
@ -323,7 +322,7 @@ class DNSNameConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_name, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_error_special_char(self):
|
||||
|
@ -336,7 +335,7 @@ class DNSNameConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_name, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_error_tld_allnumeric(self):
|
||||
|
@ -348,7 +347,7 @@ class DNSNameConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_name, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_none(self):
|
||||
|
@ -372,7 +371,7 @@ class DNSDomainConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_domain, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_none(self):
|
||||
|
@ -396,7 +395,7 @@ class FIPDNSNameConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(dns_name, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_none(self):
|
||||
|
@ -422,7 +421,7 @@ class ExpirationConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(expiration, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_before_current_time(self):
|
||||
|
@ -433,7 +432,7 @@ class ExpirationConstraintTest(common.HeatTestCase):
|
|||
self.assertFalse(self.constraint.validate(expiration, self.ctx))
|
||||
self.assertEqual(
|
||||
expected,
|
||||
six.text_type(self.constraint._error_message)
|
||||
str(self.constraint._error_message)
|
||||
)
|
||||
|
||||
def test_validation_none(self):
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from heat.db.sqlalchemy import api as db_api
|
||||
from heat.engine import service
|
||||
from heat.engine import stack
|
||||
|
@ -49,7 +47,7 @@ class Engine(message_processor.MessageProcessor):
|
|||
"""Converts the scenario template into hot template."""
|
||||
hot_tmpl = {"heat_template_version": "2013-05-23"}
|
||||
resources = {}
|
||||
for res_name, res_def in six.iteritems(scenario_tmpl.resources):
|
||||
for res_name, res_def in scenario_tmpl.resources.items():
|
||||
props = getattr(res_def, 'properties')
|
||||
depends = getattr(res_def, 'depends_on')
|
||||
res_defn = {"type": "OS::Heat::TestResource"}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
import collections
|
||||
import functools
|
||||
import inspect
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_messaging import rpc
|
||||
|
@ -30,12 +29,9 @@ def asynchronous(function):
|
|||
run on a future iteration of the event loop.
|
||||
"""
|
||||
|
||||
if six.PY2:
|
||||
arg_names = inspect.getargspec(function).args
|
||||
else:
|
||||
sig = inspect.signature(function)
|
||||
arg_names = [name for name, param in sig.parameters.items()
|
||||
if param.kind == param.POSITIONAL_OR_KEYWORD]
|
||||
sig = inspect.signature(function)
|
||||
arg_names = [name for name, param in sig.parameters.items()
|
||||
if param.kind == param.POSITIONAL_OR_KEYWORD]
|
||||
MessageData = collections.namedtuple(function.__name__, arg_names[1:])
|
||||
|
||||
@functools.wraps(function)
|
||||
|
|
|
@ -23,7 +23,6 @@ import mock
|
|||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exception
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from sqlalchemy.orm import exc
|
||||
from sqlalchemy.orm import session
|
||||
|
||||
|
@ -1015,7 +1014,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
db_api.user_creds_create,
|
||||
self.ctx)
|
||||
self.assertIn('Length of OS_PASSWORD after encryption exceeds '
|
||||
'Heat limit (255 chars)', six.text_type(error))
|
||||
'Heat limit (255 chars)', str(error))
|
||||
|
||||
def test_user_creds_trust(self):
|
||||
self.ctx.username = None
|
||||
|
@ -1138,12 +1137,12 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
db_api.software_config_get,
|
||||
self.ctx,
|
||||
scf_id)
|
||||
self.assertIn(scf_id, six.text_type(err))
|
||||
self.assertIn(scf_id, str(err))
|
||||
|
||||
err = self.assertRaises(
|
||||
exception.NotFound, db_api.software_config_delete,
|
||||
self.ctx, scf_id)
|
||||
self.assertIn(scf_id, six.text_type(err))
|
||||
self.assertIn(scf_id, str(err))
|
||||
|
||||
def test_software_config_delete_by_admin(self):
|
||||
scf_id = self._create_software_config_record()
|
||||
|
@ -1171,7 +1170,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
self.ctx, config_id)
|
||||
msg = ("Software config with id %s can not be deleted as it is "
|
||||
"referenced" % config_id)
|
||||
self.assertIn(msg, six.text_type(err))
|
||||
self.assertIn(msg, str(err))
|
||||
|
||||
def _deployment_values(self):
|
||||
tenant_id = self.ctx.tenant_id
|
||||
|
@ -1260,7 +1259,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
err = self.assertRaises(exception.NotFound,
|
||||
db_api.software_deployment_update,
|
||||
self.ctx, deployment_id, values={})
|
||||
self.assertIn(deployment_id, six.text_type(err))
|
||||
self.assertIn(deployment_id, str(err))
|
||||
values = self._deployment_values()
|
||||
deployment = db_api.software_deployment_create(self.ctx, values)
|
||||
deployment_id = deployment.id
|
||||
|
@ -1282,7 +1281,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
err = self.assertRaises(exception.NotFound,
|
||||
db_api.software_deployment_delete,
|
||||
self.ctx, deployment_id)
|
||||
self.assertIn(deployment_id, six.text_type(err))
|
||||
self.assertIn(deployment_id, str(err))
|
||||
values = self._deployment_values()
|
||||
deployment = db_api.software_deployment_create(self.ctx, values)
|
||||
deployment_id = deployment.id
|
||||
|
@ -1297,7 +1296,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
test_ctx,
|
||||
deployment_id)
|
||||
|
||||
self.assertIn(deployment_id, six.text_type(err))
|
||||
self.assertIn(deployment_id, str(err))
|
||||
|
||||
def test_software_deployment_delete(self):
|
||||
self._test_software_deployment_delete()
|
||||
|
@ -1384,7 +1383,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
err = self.assertRaises(exception.NotFound,
|
||||
db_api.snapshot_update,
|
||||
self.ctx, snapshot_id, values={})
|
||||
self.assertIn(snapshot_id, six.text_type(err))
|
||||
self.assertIn(snapshot_id, str(err))
|
||||
|
||||
def test_snapshot_update(self):
|
||||
template = create_raw_template(self.ctx)
|
||||
|
@ -1404,7 +1403,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
err = self.assertRaises(exception.NotFound,
|
||||
db_api.snapshot_delete,
|
||||
self.ctx, snapshot_id)
|
||||
self.assertIn(snapshot_id, six.text_type(err))
|
||||
self.assertIn(snapshot_id, str(err))
|
||||
|
||||
def test_snapshot_delete(self):
|
||||
template = create_raw_template(self.ctx)
|
||||
|
@ -1424,7 +1423,7 @@ class SqlAlchemyTest(common.HeatTestCase):
|
|||
self.ctx,
|
||||
snapshot_id)
|
||||
|
||||
self.assertIn(snapshot_id, six.text_type(err))
|
||||
self.assertIn(snapshot_id, str(err))
|
||||
|
||||
def test_snapshot_get_all(self):
|
||||
template = create_raw_template(self.ctx)
|
||||
|
@ -1686,7 +1685,7 @@ class DBAPIUserCredsTest(common.HeatTestCase):
|
|||
self.ctx, user_creds['id'])
|
||||
exp_msg = ('Attempt to delete user creds with id '
|
||||
'%s that does not exist' % user_creds['id'])
|
||||
self.assertIn(exp_msg, six.text_type(err))
|
||||
self.assertIn(exp_msg, str(err))
|
||||
self.assertEqual(0, mock_delete.call_count)
|
||||
|
||||
def test_user_creds_delete_retries(self):
|
||||
|
|
Loading…
Reference in New Issue