Merge "Remove six and python 2.7 full support"

This commit is contained in:
Zuul 2020-05-03 05:51:17 +00:00 committed by Gerrit Code Review
commit 0654bc19a8
10 changed files with 25 additions and 34 deletions

View File

@ -16,7 +16,6 @@ import copy
import json
import mock
import six
from heat.common import exception
from heat.common import template_format
@ -350,7 +349,7 @@ class AodhAlarmTest(common.HeatTestCase):
rsrc.properties.data = rsrc.get_alarm_props(properties)
self.assertIsNone(rsrc.properties.data.get('matching_metadata'))
for key in rsrc.properties.data['threshold_rule']['query']:
self.assertIsInstance(key['value'], six.text_type)
self.assertIsInstance(key['value'], str)
def test_no_matching_metadata(self):
"""Make sure that we can pass in an empty matching_metadata."""
@ -381,7 +380,7 @@ class AodhAlarmTest(common.HeatTestCase):
rsrc.validate)
self.assertEqual(
"Property error: Resources.MEMAlarmHigh.Properties.%s: "
"Value '60a' is not an integer" % p, six.text_type(error))
"Value '60a' is not an integer" % p, str(error))
def test_mem_alarm_high_not_integer_parameters(self):
orig_snippet = template_format.parse(not_string_alarm_template)
@ -415,7 +414,7 @@ class AodhAlarmTest(common.HeatTestCase):
self.assertEqual(
"Property error: Resources.MEMAlarmHigh.Properties: "
"Property meter_name not assigned",
six.text_type(error))
str(error))
for p in ('period', 'evaluation_periods', 'statistic',
'comparison_operator'):

View File

@ -14,7 +14,6 @@
import copy
import mock
import six
from heat.common import exception
from heat.common import template_format
@ -138,7 +137,7 @@ class CompositeAlarmTest(common.HeatTestCase):
exc = self.assertRaises(exception.StackValidationFailed,
res.validate)
self.assertIn(error_msg, six.text_type(exc))
self.assertIn(error_msg, str(exc))
def test_show_resource(self):
test_stack = self.create_stack(template=alarm_template)

View File

@ -12,7 +12,6 @@
# under the License.
import mock
import six
from heat.common import exception
from heat.common import template_format
@ -205,5 +204,5 @@ class TestContainer(common.HeatTestCase):
self.client.containers.get.return_value = mock_not_active
exc = self.assertRaises(exception.ResourceInError,
res.check_create_complete, 'foo')
self.assertIn('foo', six.text_type(exc))
self.assertIn('500', six.text_type(exc))
self.assertIn('foo', str(exc))
self.assertIn('500', str(exc))

View File

@ -12,7 +12,6 @@
# under the License.
import mock
import six
from heat.common import exception
from heat.common import template_format
@ -231,5 +230,5 @@ class TestOrder(common.HeatTestCase):
self.barbican.orders.get.return_value = mock_not_active
exc = self.assertRaises(exception.Error,
res.check_create_complete, 'foo')
self.assertIn('foo', six.text_type(exc))
self.assertIn('500', six.text_type(exc))
self.assertIn('foo', str(exc))
self.assertIn('500', str(exc))

View File

@ -11,7 +11,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import six
from heat.common import exception
from heat.common import template_format
@ -80,7 +79,7 @@ class CinderQuotaTest(common.HeatTestCase):
def _test_validate(self, resource, error_msg):
exc = self.assertRaises(exception.StackValidationFailed,
resource.validate)
self.assertIn(error_msg, six.text_type(exc))
self.assertIn(error_msg, str(exc))
def _test_invalid_property(self, prop_name):
my_quota = self.stack['my_quota']
@ -156,7 +155,7 @@ class CinderQuotaTest(common.HeatTestCase):
err = self.assertRaises(ValueError, self.my_quota.handle_create)
self.assertEqual(
self.err_msg % {'property': 'gigabytes', 'value': 5, 'total': 6},
six.text_type(err))
str(err))
def test_quota_with_invalid_volumes(self):
fake_v = self.fv(0)
@ -167,7 +166,7 @@ class CinderQuotaTest(common.HeatTestCase):
err = self.assertRaises(ValueError, self.my_quota.handle_create)
self.assertEqual(
self.err_msg % {'property': 'volumes', 'value': 3, 'total': 4},
six.text_type(err))
str(err))
def test_quota_with_invalid_snapshots(self):
fake_v = self.fv(0)
@ -179,7 +178,7 @@ class CinderQuotaTest(common.HeatTestCase):
err = self.assertRaises(ValueError, self.my_quota.handle_create)
self.assertEqual(
self.err_msg % {'property': 'snapshots', 'value': 2, 'total': 4},
six.text_type(err))
str(err))
def _test_quota_with_unlimited_value(self, prop_name):
my_quota = self.stack['my_quota']

View File

@ -18,7 +18,6 @@ import json
from cinderclient import exceptions as cinder_exp
import mock
from oslo_config import cfg
import six
from heat.common import exception
from heat.common import template_format
@ -119,7 +118,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
self.t, stack, 'volume')
self.assertEqual(
"Property error: resources.volume.properties.size: "
"0 is out of range (min: 1, max: None)", six.text_type(error))
"0 is out of range (min: 1, max: None)", str(error))
def test_cinder_create(self):
fv = vt_base.FakeVolume('creating')
@ -272,7 +271,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
rsrc.FnGetAtt, 'unknown')
self.assertEqual(
'The Referenced Attribute (volume unknown) is incorrect.',
six.text_type(error))
str(error))
self.cinder_fc.volumes.get.assert_called_with('vol-123')
@ -358,7 +357,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
ex = self.assertRaises(exception.ResourceFailure, update_task)
self.assertEqual('NotSupported: resources.volume: '
'Shrinking volume is not supported.',
six.text_type(ex))
str(ex))
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
@ -408,7 +407,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
update_task = scheduler.TaskRunner(rsrc.update, after)
ex = self.assertRaises(exception.ResourceFailure, update_task)
self.assertIn('Over limit', six.text_type(ex))
self.assertIn('Over limit', str(ex))
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
self.cinder_fc.volumes.extend.assert_called_once_with(fv.id, 2)
@ -436,7 +435,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
update_task = scheduler.TaskRunner(rsrc.update, after)
ex = self.assertRaises(exception.ResourceFailure, update_task)
self.assertIn("Volume resize failed - Unknown status error_extending",
six.text_type(ex))
str(ex))
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
self.cinder_fc.volumes.extend.assert_called_once_with(fv.id, 2)
@ -598,7 +597,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
ex = self.assertRaises(exception.ResourceFailure, update_task)
self.assertEqual((rsrc.UPDATE, rsrc.FAILED), rsrc.state)
self.assertIn("NotSupported: resources.volume2: Shrinking volume is "
"not supported", six.text_type(ex))
"not supported", str(ex))
props = copy.deepcopy(rsrc.properties.data)
props['size'] = 3
@ -1006,7 +1005,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
vp.update(combinations)
rsrc = stack['volume2']
ex = self.assertRaises(exc, rsrc.validate)
self.assertEqual(err_msg, six.text_type(ex))
self.assertEqual(err_msg, str(ex))
def test_cinder_create_with_image_and_imageRef(self):
self.stack_name = 'test_create_with_image_and_imageRef'
@ -1020,7 +1019,7 @@ class CinderVolumeTest(vt_base.VolumeTestCase):
vp.update(combinations)
rsrc = stack.get('volume2')
ex = self.assertRaises(exception.StackValidationFailed, rsrc.validate)
self.assertIn(err_msg, six.text_type(ex))
self.assertIn(err_msg, str(ex))
def test_cinder_create_with_image_and_size(self):
self.stack_name = 'test_create_with_image_and_size'

View File

@ -12,7 +12,6 @@
# under the License.
import collections
import mock
import six
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin
@ -185,7 +184,7 @@ class CinderVolumeTypeTest(common.HeatTestCase):
self.my_volume_type.validate)
expected = ('Can not specify property "projects" '
'if the volume type is public.')
self.assertEqual(expected, six.text_type(ex))
self.assertEqual(expected, str(ex))
def test_validate_projects_when_private(self):
tmpl = self.stack.t.t

View File

@ -13,7 +13,6 @@
from cinderclient.v2 import client as cinderclient
import mock
import six
from heat.engine.clients.os import cinder
from heat.engine.clients.os import nova
@ -122,7 +121,7 @@ class FakeVolume(object):
def __init__(self, status, **attrs):
self.status = status
for key, value in six.iteritems(attrs):
for key, value in attrs.items():
setattr(self, key, value)
if 'id' not in attrs:
self.id = self._ID

View File

@ -12,7 +12,6 @@
# under the License.
import mock
import six
from glanceclient import exc
from heat.common import exception
@ -116,7 +115,7 @@ class GlanceImageTest(common.HeatTestCase):
def _test_validate(self, resource, error_msg):
exc = self.assertRaises(exception.StackValidationFailed,
resource.validate)
self.assertIn(error_msg, six.text_type(exc))
self.assertIn(error_msg, str(exc))
def test_invalid_min_disk(self):
# invalid 'min_disk'
@ -482,7 +481,7 @@ class GlanceWebImageTest(common.HeatTestCase):
def _test_validate(self, resource, error_msg):
exc = self.assertRaises(exception.StackValidationFailed,
resource.validate)
self.assertIn(error_msg, six.text_type(exc))
self.assertIn(error_msg, str(exc))
def test_invalid_min_disk(self):
# invalid 'min_disk'

View File

@ -15,7 +15,7 @@ import mock
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from six.moves.urllib import parse as urlparse
from urllib import parse as urlparse
from heat.common import exception
from heat.common import template_format