Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
a76d773804
|
@ -14,7 +14,6 @@
|
|||
import copy
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import grouputils
|
||||
|
@ -86,14 +85,14 @@ class TestInstanceGroup(common.HeatTestCase):
|
|||
props['LaunchConfigurationName'] = 'JobServerConfig'
|
||||
error = self.assertRaises(ValueError, self.instance_group.validate)
|
||||
self.assertIn('(JobServerConfig) reference can not be found',
|
||||
six.text_type(error))
|
||||
str(error))
|
||||
# test resource name of instance group not WebServerGroup, so no ref
|
||||
props['LaunchConfigurationName'] = 'LaunchConfig'
|
||||
error = self.assertRaises(ValueError, self.instance_group.validate)
|
||||
self.assertIn('LaunchConfigurationName (LaunchConfig) requires a '
|
||||
'reference to the configuration not just the '
|
||||
'name of the resource.',
|
||||
six.text_type(error))
|
||||
str(error))
|
||||
# test validate ok if change instance_group name to 'WebServerGroup'
|
||||
self.instance_group.name = 'WebServerGroup'
|
||||
self.instance_group.validate()
|
||||
|
@ -150,7 +149,7 @@ class TestInstanceGroup(common.HeatTestCase):
|
|||
'2.1.3.3'])
|
||||
mock_members = self.patchobject(grouputils, 'get_members')
|
||||
instances = []
|
||||
for ip_ex in six.moves.range(1, 4):
|
||||
for ip_ex in range(1, 4):
|
||||
inst = mock.Mock()
|
||||
inst.FnGetAtt.return_value = '2.1.3.%d' % ip_ex
|
||||
instances.append(inst)
|
||||
|
@ -163,7 +162,7 @@ class TestInstanceGroup(common.HeatTestCase):
|
|||
side_effect=exception.NotFound)
|
||||
mock_members = self.patchobject(grouputils, 'get_members')
|
||||
instances = []
|
||||
for ip_ex in six.moves.range(1, 4):
|
||||
for ip_ex in range(1, 4):
|
||||
inst = mock.Mock()
|
||||
inst.FnGetAtt.return_value = '2.1.3.%d' % ip_ex
|
||||
instances.append(inst)
|
||||
|
@ -332,7 +331,7 @@ class LoadbalancerReloadTest(common.HeatTestCase):
|
|||
self.assertEqual(
|
||||
"Unsupported resource 'ElasticLoadBalancer' in "
|
||||
"LoadBalancerNames",
|
||||
six.text_type(error))
|
||||
str(error))
|
||||
|
||||
def test_lb_reload_static_resolve(self):
|
||||
t = template_format.parse(inline_templates.as_template)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
import re
|
||||
|
||||
import mock
|
||||
import six
|
||||
from testtools import matchers
|
||||
|
||||
from heat.common import exception
|
||||
|
@ -193,7 +192,7 @@ Resources:
|
|||
self.create_stack, template_random_string)
|
||||
self.assertEqual("Length property cannot be smaller than combined "
|
||||
"character class and character sequence minimums",
|
||||
six.text_type(exc))
|
||||
str(exc))
|
||||
|
||||
def test_max_length(self):
|
||||
template_random_string = '''
|
||||
|
@ -222,7 +221,7 @@ Resources:
|
|||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
self.create_stack, template_random_string)
|
||||
self.assertIn('513 is out of range (min: 1, max: 512)',
|
||||
six.text_type(exc))
|
||||
str(exc))
|
||||
|
||||
|
||||
class TestGenerateRandomString(common.HeatTestCase):
|
||||
|
|
|
@ -19,7 +19,6 @@ from heatclient.v1 import stacks
|
|||
from keystoneauth1 import loading as ks_loading
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -261,7 +260,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
rsrc.validate)
|
||||
msg = ('Cannot establish connection to Heat endpoint '
|
||||
'at region "%s"' % self.bad_region)
|
||||
self.assertIn(msg, six.text_type(ex))
|
||||
self.assertIn(msg, str(ex))
|
||||
|
||||
def test_remote_validation_failed(self):
|
||||
parent, rsrc = self.create_parent_stack(remote_region=self.that_region,
|
||||
|
@ -282,7 +281,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
ex = self.assertRaises(exception.StackValidationFailed, rsrc.validate)
|
||||
msg = ('Failed validating stack template using Heat endpoint at region'
|
||||
' "%s"') % self.that_region
|
||||
self.assertIn(msg, six.text_type(ex))
|
||||
self.assertIn(msg, str(ex))
|
||||
|
||||
def test_create(self):
|
||||
rsrc = self.create_remote_stack()
|
||||
|
@ -395,7 +394,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = ('ResourceInError: resources.remote_stack: '
|
||||
'Went to status CREATE_FAILED due to '
|
||||
'"Remote stack creation failed"')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
|
||||
|
||||
def test_delete(self):
|
||||
|
@ -441,7 +440,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = ('ResourceInError: resources.remote_stack: '
|
||||
'Went to status DELETE_FAILED due to '
|
||||
'"Remote stack deletion failed"')
|
||||
self.assertIn(error_msg, six.text_type(error))
|
||||
self.assertIn(error_msg, str(error))
|
||||
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
|
||||
self.heat.stacks.delete.assert_called_with(stack_id=remote_stack_id)
|
||||
self.assertEqual(rsrc.resource_id, remote_stack_id)
|
||||
|
@ -470,7 +469,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
self.assertEqual(
|
||||
'The Referenced Attribute (remote_stack non-existent_property) is '
|
||||
'incorrect.',
|
||||
six.text_type(error))
|
||||
str(error))
|
||||
|
||||
def test_snapshot(self):
|
||||
stacks = [get_stack(stack_status='SNAPSHOT_IN_PROGRESS'),
|
||||
|
@ -563,7 +562,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = ('ResourceInError: resources.remote_stack: '
|
||||
'Went to status CHECK_FAILED due to '
|
||||
'"Remote stack check failed"')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.CHECK, rsrc.FAILED), rsrc.state)
|
||||
self.heat.actions.check.assert_called_with(stack_id=rsrc.resource_id)
|
||||
|
||||
|
@ -596,7 +595,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = ('ResourceInError: resources.remote_stack: '
|
||||
'Went to status RESUME_FAILED due to '
|
||||
'"Remote stack resume failed"')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.RESUME, rsrc.FAILED), rsrc.state)
|
||||
self.heat.actions.resume.assert_called_with(stack_id=rsrc.resource_id)
|
||||
|
||||
|
@ -608,7 +607,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
scheduler.TaskRunner(rsrc.resume))
|
||||
error_msg = ('Error: resources.remote_stack: '
|
||||
'Cannot resume remote_stack, resource not found')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.RESUME, rsrc.FAILED), rsrc.state)
|
||||
|
||||
def test_suspend(self):
|
||||
|
@ -638,7 +637,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = ('ResourceInError: resources.remote_stack: '
|
||||
'Went to status SUSPEND_FAILED due to '
|
||||
'"Remote stack suspend failed"')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.SUSPEND, rsrc.FAILED), rsrc.state)
|
||||
# assert suspend was not called
|
||||
self.heat.actions.suspend.assert_has_calls([])
|
||||
|
@ -652,7 +651,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
scheduler.TaskRunner(rsrc.suspend))
|
||||
error_msg = ('Error: resources.remote_stack: '
|
||||
'Cannot suspend remote_stack, resource not found')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.SUSPEND, rsrc.FAILED), rsrc.state)
|
||||
# assert suspend was not called
|
||||
self.heat.actions.suspend.assert_has_calls([])
|
||||
|
@ -719,7 +718,7 @@ class RemoteStackTest(tests_common.HeatTestCase):
|
|||
error_msg = _('ResourceInError: resources.remote_stack: '
|
||||
'Went to status UPDATE_FAILED due to '
|
||||
'"Remote stack update failed"')
|
||||
self.assertEqual(error_msg, six.text_type(error))
|
||||
self.assertEqual(error_msg, str(error))
|
||||
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
|
||||
self.assertEqual(2, len(self.heat.stacks.get.call_args_list))
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
import copy
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import node_data
|
||||
|
@ -348,7 +347,7 @@ class ResourceChainAttrTest(common.HeatTestCase):
|
|||
ex = self.assertRaises(exception.NotFound, chain.FnGetAtt,
|
||||
'resource.2')
|
||||
self.assertIn("Member '2' not found in group resource 'test'",
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
|
||||
def _create_dummy_stack(self, expect_count=2, expect_attrs=None):
|
||||
self.stack = utils.parse_stack(TEMPLATE)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
import copy
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import grouputils
|
||||
|
@ -685,7 +684,7 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
resg.validate)
|
||||
exp_msg = 'The Resource Type (idontexist) could not be found.'
|
||||
self.assertIn(exp_msg, six.text_type(exc))
|
||||
self.assertIn(exp_msg, str(exc))
|
||||
|
||||
def test_reference_attr(self):
|
||||
stack = utils.parse_stack(template2)
|
||||
|
@ -712,7 +711,7 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
resg.validate)
|
||||
errstr = "removal_policies: \"'notallowed'\" is not a list"
|
||||
self.assertIn(errstr, six.text_type(exc))
|
||||
self.assertIn(errstr, str(exc))
|
||||
|
||||
def test_invalid_removal_policies_nomap(self):
|
||||
"""Test that error raised for malformed removal_policies."""
|
||||
|
@ -725,7 +724,7 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
resg.validate)
|
||||
errstr = '"notallowed" is not a map'
|
||||
self.assertIn(errstr, six.text_type(exc))
|
||||
self.assertIn(errstr, str(exc))
|
||||
|
||||
def test_child_template(self):
|
||||
stack = utils.parse_stack(template2)
|
||||
|
@ -1103,7 +1102,7 @@ class ResourceGroupAttrTest(common.HeatTestCase):
|
|||
ex = self.assertRaises(exception.NotFound, resg.FnGetAtt,
|
||||
'resource.2')
|
||||
self.assertIn("Member '2' not found in group resource 'group1'.",
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
|
||||
def test_get_attribute_convg(self):
|
||||
cache_data = {'group1': node_data.NodeData.from_dict({
|
||||
|
@ -1363,7 +1362,7 @@ class RollingUpdatePolicyTest(common.HeatTestCase):
|
|||
stack = utils.parse_stack(tmpl)
|
||||
error = self.assertRaises(
|
||||
exception.StackValidationFailed, stack.validate)
|
||||
self.assertIn("foo", six.text_type(error))
|
||||
self.assertIn("foo", str(error))
|
||||
|
||||
|
||||
class RollingUpdatePolicyDiffTest(common.HeatTestCase):
|
||||
|
@ -1459,7 +1458,7 @@ class RollingUpdateTest(common.HeatTestCase):
|
|||
err = self.assertRaises(ValueError, self.current_grp._update_timeout,
|
||||
3, 100)
|
||||
self.assertIn('The current update policy will result in stack update '
|
||||
'timeout.', six.text_type(err))
|
||||
'timeout.', str(err))
|
||||
|
||||
def test_update_time_sufficient(self):
|
||||
current = copy.deepcopy(template)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
import contextlib
|
||||
import mock
|
||||
import six
|
||||
|
||||
from heat.common import exception as exc
|
||||
from heat.common import template_format
|
||||
|
@ -282,6 +281,6 @@ class SoftwareComponentValidationTest(common.HeatTestCase):
|
|||
if self.err:
|
||||
err = self.assertRaises(self.err, self.stack.validate)
|
||||
if self.err_msg:
|
||||
self.assertIn(self.err_msg, six.text_type(err))
|
||||
self.assertIn(self.err_msg, str(err))
|
||||
else:
|
||||
self.assertIsNone(self.stack.validate())
|
||||
|
|
|
@ -17,7 +17,6 @@ import re
|
|||
import uuid
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
|
@ -230,7 +229,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
|||
err = self.assertRaises(exc.StackValidationFailed, deployment.validate)
|
||||
self.assertEqual("Property error: "
|
||||
"Resources.deployment_mysql.Properties: "
|
||||
"Property server not assigned", six.text_type(err))
|
||||
"Property server not assigned", str(err))
|
||||
|
||||
def test_validate_failed(self):
|
||||
template = dict(self.template_with_server)
|
||||
|
@ -242,7 +241,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
|||
self.assertEqual("Resource server's property "
|
||||
"user_data_format should be set to "
|
||||
"SOFTWARE_CONFIG since there are "
|
||||
"software deployments on it.", six.text_type(err))
|
||||
"software deployments on it.", str(err))
|
||||
|
||||
def mock_software_config(self):
|
||||
config = {
|
||||
|
@ -682,7 +681,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
|||
err = self.assertRaises(
|
||||
exc.Error, self.deployment.check_create_complete, mock_sd)
|
||||
self.assertEqual(
|
||||
'Deployment to server failed: something wrong', six.text_type(err))
|
||||
'Deployment to server failed: something wrong', str(err))
|
||||
|
||||
def test_handle_create_cancel(self):
|
||||
self._create_stack(self.template)
|
||||
|
@ -1145,7 +1144,7 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
|||
self.deployment.FnGetAtt, 'foo2')
|
||||
self.assertEqual(
|
||||
'The Referenced Attribute (deployment_mysql foo2) is incorrect.',
|
||||
six.text_type(err))
|
||||
str(err))
|
||||
|
||||
def test_handle_action(self):
|
||||
self._create_stack(self.template)
|
||||
|
|
|
@ -17,7 +17,6 @@ import uuid
|
|||
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from swiftclient import client as swiftclient_client
|
||||
from swiftclient import exceptions as swiftclient_exceptions
|
||||
from testtools import matchers
|
||||
|
@ -201,7 +200,7 @@ class SwiftSignalHandleTest(common.HeatTestCase):
|
|||
scheduler.TaskRunner(rsrc.delete))
|
||||
self.assertEqual('ClientException: '
|
||||
'resources.test_wait_condition_handle: '
|
||||
'Overlimit: 413', six.text_type(exc))
|
||||
'Overlimit: 413', str(exc))
|
||||
|
||||
@mock.patch.object(swift.SwiftClientPlugin, '_create')
|
||||
@mock.patch.object(resource.Resource, 'physical_resource_name')
|
||||
|
@ -232,7 +231,7 @@ class SwiftSignalHandleTest(common.HeatTestCase):
|
|||
scheduler.TaskRunner(rsrc.delete))
|
||||
self.assertEqual('ClientException: '
|
||||
'resources.test_wait_condition_handle: '
|
||||
'Overlimit: 413', six.text_type(exc))
|
||||
'Overlimit: 413', str(exc))
|
||||
|
||||
@mock.patch.object(swift.SwiftClientPlugin, '_create')
|
||||
@mock.patch.object(resource.Resource, 'physical_resource_name')
|
||||
|
@ -328,7 +327,7 @@ class SwiftSignalTest(common.HeatTestCase):
|
|||
|
||||
st.create()
|
||||
self.assertIn('not a valid SwiftSignalHandle. The Swift TempURL path',
|
||||
six.text_type(st.status_reason))
|
||||
str(st.status_reason))
|
||||
|
||||
@mock.patch.object(swift.SwiftClientPlugin, 'get_signal_url')
|
||||
def test_validate_handle_url_bad_container_name(self, mock_handle_url):
|
||||
|
@ -341,7 +340,7 @@ class SwiftSignalTest(common.HeatTestCase):
|
|||
|
||||
st.create()
|
||||
self.assertIn('not a valid SwiftSignalHandle. The container name',
|
||||
six.text_type(st.status_reason))
|
||||
str(st.status_reason))
|
||||
|
||||
@mock.patch.object(swift.SwiftClientPlugin, '_create')
|
||||
@mock.patch.object(resource.Resource, 'physical_resource_name')
|
||||
|
@ -391,7 +390,7 @@ class SwiftSignalTest(common.HeatTestCase):
|
|||
|
||||
time_now = timeutils.utcnow()
|
||||
time_series = [datetime.timedelta(0, t) + time_now
|
||||
for t in six.moves.xrange(1, 100)]
|
||||
for t in range(1, 100)]
|
||||
timeutils.set_time_override(time_series)
|
||||
self.addCleanup(timeutils.clear_time_override)
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import uuid
|
|||
import mock
|
||||
from oslo_serialization import jsonutils as json
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from heat.common import identifier
|
||||
from heat.common import template_format
|
||||
|
@ -262,7 +261,7 @@ class HeatWaitConditionTest(common.HeatTestCase):
|
|||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
wc_att = rsrc.FnGetAtt('data')
|
||||
self.assertEqual(six.text_type({}), wc_att)
|
||||
self.assertEqual(str({}), wc_att)
|
||||
|
||||
handle = self.stack['wait_handle']
|
||||
self.assertEqual((handle.CREATE, handle.COMPLETE), handle.state)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
|
||||
from heat.engine import resource
|
||||
|
|
Loading…
Reference in New Issue