Prepare for hacking 6.x
This brings in a new version of flake8 as well as additional checks of its own. Address all of them in advance of the bump. Change-Id: I870bd8110106d4714db7ead94429fad6a74beb88 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
69735d3bd8
commit
6baf11f606
@ -263,10 +263,10 @@ class Object(_base.BaseResource):
|
|||||||
attr_keys_to_delete = set()
|
attr_keys_to_delete = set()
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if key == 'delete_after':
|
if key == 'delete_after':
|
||||||
del(metadata['delete_at'])
|
del metadata['delete_at']
|
||||||
else:
|
else:
|
||||||
if key in metadata:
|
if key in metadata:
|
||||||
del(metadata[key])
|
del metadata[key]
|
||||||
# Delete the attribute from the local copy of the object.
|
# Delete the attribute from the local copy of the object.
|
||||||
# Metadata that doesn't have Component attributes is
|
# Metadata that doesn't have Component attributes is
|
||||||
# handled by self.metadata being reset when we run
|
# handled by self.metadata being reset when we run
|
||||||
|
@ -99,7 +99,7 @@ class _BaseComponent:
|
|||||||
deprecation_reason = None
|
deprecation_reason = None
|
||||||
|
|
||||||
#: Control field used to manage the deprecation warning. We want to warn
|
#: Control field used to manage the deprecation warning. We want to warn
|
||||||
# only once when the attribute is retrieved in the code.
|
#: only once when the attribute is retrieved in the code.
|
||||||
already_warned_deprecation = False
|
already_warned_deprecation = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -1009,7 +1009,8 @@ class Resource(dict):
|
|||||||
return cls(_synchronized=synchronized, connection=connection, **obj)
|
return cls(_synchronized=synchronized, connection=connection, **obj)
|
||||||
|
|
||||||
def _attr_to_dict(self, attr, to_munch):
|
def _attr_to_dict(self, attr, to_munch):
|
||||||
"""For a given attribute, convert it into a form suitable for a dict value.
|
"""For a given attribute, convert it into a form suitable for a dict
|
||||||
|
value.
|
||||||
|
|
||||||
:param bool attr: Attribute name to convert
|
:param bool attr: Attribute name to convert
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class TestCompute(base.BaseFunctionalTest):
|
|||||||
# returning a string tests that the call is correct. Testing that
|
# returning a string tests that the call is correct. Testing that
|
||||||
# the cloud returns actual data in the output is out of scope.
|
# the cloud returns actual data in the output is out of scope.
|
||||||
log = self.user_cloud._get_server_console_output(server_id=server.id)
|
log = self.user_cloud._get_server_console_output(server_id=server.id)
|
||||||
self.assertTrue(isinstance(log, str))
|
self.assertIsInstance(log, str)
|
||||||
|
|
||||||
def test_get_server_console_name_or_id(self):
|
def test_get_server_console_name_or_id(self):
|
||||||
self.addCleanup(self._cleanup_servers_and_volumes, self.server_name)
|
self.addCleanup(self._cleanup_servers_and_volumes, self.server_name)
|
||||||
@ -210,7 +210,7 @@ class TestCompute(base.BaseFunctionalTest):
|
|||||||
flavor=self.flavor,
|
flavor=self.flavor,
|
||||||
wait=True)
|
wait=True)
|
||||||
log = self.user_cloud.get_server_console(server=self.server_name)
|
log = self.user_cloud.get_server_console(server=self.server_name)
|
||||||
self.assertTrue(isinstance(log, str))
|
self.assertIsInstance(log, str)
|
||||||
|
|
||||||
def test_list_availability_zone_names(self):
|
def test_list_availability_zone_names(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -117,4 +117,4 @@ class TestNetworkQuotas(base.BaseFunctionalTest):
|
|||||||
quota_val = quota_details[quota]
|
quota_val = quota_details[quota]
|
||||||
if quota_val:
|
if quota_val:
|
||||||
for expected_key in expected_keys:
|
for expected_key in expected_keys:
|
||||||
self.assertTrue(expected_key in quota_val)
|
self.assertIn(expected_key, quota_val)
|
||||||
|
@ -760,8 +760,8 @@ class TestCase(base.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def assertResourceListEqual(self, actual, expected, resource_type):
|
def assertResourceListEqual(self, actual, expected, resource_type):
|
||||||
"""Helper for the assertEqual which compares Resource lists object against
|
"""Helper for the assertEqual which compares Resource lists object
|
||||||
dictionary representing expected state.
|
against dictionary representing expected state.
|
||||||
|
|
||||||
:param list actual: List of actual objects.
|
:param list actual: List of actual objects.
|
||||||
:param listexpected: List of dictionaries representing expected
|
:param listexpected: List of dictionaries representing expected
|
||||||
|
@ -561,9 +561,9 @@ class TestImage(BaseTestImage):
|
|||||||
)
|
)
|
||||||
|
|
||||||
image_no_checksums = self.fake_image_dict.copy()
|
image_no_checksums = self.fake_image_dict.copy()
|
||||||
del(image_no_checksums['owner_specified.openstack.md5'])
|
del image_no_checksums['owner_specified.openstack.md5']
|
||||||
del(image_no_checksums['owner_specified.openstack.sha256'])
|
del image_no_checksums['owner_specified.openstack.sha256']
|
||||||
del(image_no_checksums['owner_specified.openstack.object'])
|
del image_no_checksums['owner_specified.openstack.object']
|
||||||
|
|
||||||
self.register_uris([
|
self.register_uris([
|
||||||
dict(method='GET',
|
dict(method='GET',
|
||||||
@ -736,9 +736,9 @@ class TestImage(BaseTestImage):
|
|||||||
object_path = self.fake_image_dict['owner_specified.openstack.object']
|
object_path = self.fake_image_dict['owner_specified.openstack.object']
|
||||||
|
|
||||||
image_no_checksums = self.fake_image_dict.copy()
|
image_no_checksums = self.fake_image_dict.copy()
|
||||||
del(image_no_checksums['owner_specified.openstack.md5'])
|
del image_no_checksums['owner_specified.openstack.md5']
|
||||||
del(image_no_checksums['owner_specified.openstack.sha256'])
|
del image_no_checksums['owner_specified.openstack.sha256']
|
||||||
del(image_no_checksums['owner_specified.openstack.object'])
|
del image_no_checksums['owner_specified.openstack.object']
|
||||||
|
|
||||||
self.register_uris([
|
self.register_uris([
|
||||||
dict(method='GET',
|
dict(method='GET',
|
||||||
|
@ -62,19 +62,19 @@ class TestServerIP(base.TestCase):
|
|||||||
self.assertEqual(4, len(ips))
|
self.assertEqual(4, len(ips))
|
||||||
ips = sorted(ips, key=lambda ip: ip.version)
|
ips = sorted(ips, key=lambda ip: ip.version)
|
||||||
|
|
||||||
self.assertEqual(type(ips[0]), server_ip.ServerIP)
|
self.assertIsInstance(ips[0], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[0].network_label, "label1")
|
self.assertEqual(ips[0].network_label, "label1")
|
||||||
self.assertEqual(ips[0].address, "a1")
|
self.assertEqual(ips[0].address, "a1")
|
||||||
self.assertEqual(ips[0].version, 1)
|
self.assertEqual(ips[0].version, 1)
|
||||||
self.assertEqual(type(ips[1]), server_ip.ServerIP)
|
self.assertIsInstance(ips[1], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[1].network_label, "label1")
|
self.assertEqual(ips[1].network_label, "label1")
|
||||||
self.assertEqual(ips[1].address, "a2")
|
self.assertEqual(ips[1].address, "a2")
|
||||||
self.assertEqual(ips[1].version, 2)
|
self.assertEqual(ips[1].version, 2)
|
||||||
self.assertEqual(type(ips[2]), server_ip.ServerIP)
|
self.assertIsInstance(ips[2], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[2].network_label, "label2")
|
self.assertEqual(ips[2].network_label, "label2")
|
||||||
self.assertEqual(ips[2].address, "a3")
|
self.assertEqual(ips[2].address, "a3")
|
||||||
self.assertEqual(ips[2].version, 3)
|
self.assertEqual(ips[2].version, 3)
|
||||||
self.assertEqual(type(ips[3]), server_ip.ServerIP)
|
self.assertIsInstance(ips[3], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[3].network_label, "label2")
|
self.assertEqual(ips[3].network_label, "label2")
|
||||||
self.assertEqual(ips[3].address, "a4")
|
self.assertEqual(ips[3].address, "a4")
|
||||||
self.assertEqual(ips[3].version, 4)
|
self.assertEqual(ips[3].version, 4)
|
||||||
@ -97,11 +97,11 @@ class TestServerIP(base.TestCase):
|
|||||||
self.assertEqual(2, len(ips))
|
self.assertEqual(2, len(ips))
|
||||||
ips = sorted(ips, key=lambda ip: ip.version)
|
ips = sorted(ips, key=lambda ip: ip.version)
|
||||||
|
|
||||||
self.assertEqual(type(ips[0]), server_ip.ServerIP)
|
self.assertIsInstance(ips[0], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[0].network_label, label)
|
self.assertEqual(ips[0].network_label, label)
|
||||||
self.assertEqual(ips[0].address, "a1")
|
self.assertEqual(ips[0].address, "a1")
|
||||||
self.assertEqual(ips[0].version, 1)
|
self.assertEqual(ips[0].version, 1)
|
||||||
self.assertEqual(type(ips[1]), server_ip.ServerIP)
|
self.assertIsInstance(ips[1], server_ip.ServerIP)
|
||||||
self.assertEqual(ips[1].network_label, label)
|
self.assertEqual(ips[1].network_label, label)
|
||||||
self.assertEqual(ips[1].address, "a2")
|
self.assertEqual(ips[1].address, "a2")
|
||||||
self.assertEqual(ips[1].version, 2)
|
self.assertEqual(ips[1].version, 2)
|
||||||
|
@ -64,8 +64,8 @@ class TestCloudRegion(base.TestCase):
|
|||||||
|
|
||||||
def test_iteration(self):
|
def test_iteration(self):
|
||||||
cc = cloud_region.CloudRegion("test1", "region-al", fake_config_dict)
|
cc = cloud_region.CloudRegion("test1", "region-al", fake_config_dict)
|
||||||
self.assertTrue('a' in cc)
|
self.assertIn('a', cc)
|
||||||
self.assertFalse('x' in cc)
|
self.assertNotIn('x', cc)
|
||||||
|
|
||||||
def test_equality(self):
|
def test_equality(self):
|
||||||
cc1 = cloud_region.CloudRegion("test1", "region-al", fake_config_dict)
|
cc1 = cloud_region.CloudRegion("test1", "region-al", fake_config_dict)
|
||||||
|
@ -40,6 +40,5 @@ class TestMissingVersion(base.TestCase):
|
|||||||
|
|
||||||
def test_unsupported_version_override(self):
|
def test_unsupported_version_override(self):
|
||||||
self.cloud.config.config['image_api_version'] = '7'
|
self.cloud.config.config['image_api_version'] = '7'
|
||||||
self.assertTrue(isinstance(self.cloud.image, proxy.Proxy))
|
self.assertIsInstance(self.cloud.image, proxy.Proxy)
|
||||||
|
|
||||||
self.assert_calls()
|
self.assert_calls()
|
||||||
|
@ -442,9 +442,10 @@ class Munch(dict):
|
|||||||
object.__setattr__(self, k, v)
|
object.__setattr__(self, k, v)
|
||||||
|
|
||||||
def __delattr__(self, k):
|
def __delattr__(self, k):
|
||||||
"""Deletes attribute k if it exists, otherwise deletes key k. A KeyError
|
"""Deletes attribute k if it exists, otherwise deletes key k.
|
||||||
raised by deleting the key--such as when the key is missing--will
|
|
||||||
propagate as an AttributeError instead.
|
A KeyError raised by deleting the key - such as when the key is missing
|
||||||
|
- will propagate as an AttributeError instead.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Throws exception if not in prototype chain
|
# Throws exception if not in prototype chain
|
||||||
|
Loading…
Reference in New Issue
Block a user