diff --git a/doc/requirements.txt b/doc/requirements.txt index 2d7f0410a7..a6f17609d3 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. openstackdocstheme>=2.2.1 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 diff --git a/magnum/api/controllers/v1/cluster.py b/magnum/api/controllers/v1/cluster.py index cc4986a354..6e1d0597d0 100644 --- a/magnum/api/controllers/v1/cluster.py +++ b/magnum/api/controllers/v1/cluster.py @@ -184,7 +184,7 @@ class Cluster(base.APIBase): master_lb_enabled = wsme.wsattr(types.boolean) """Indicates whether created clusters should have a load balancer for master nodes or not. - """ + """ # noqa: E501 def __init__(self, **kwargs): super(Cluster, self).__init__() diff --git a/magnum/api/controllers/v1/cluster_template.py b/magnum/api/controllers/v1/cluster_template.py index 997ad53cd4..9097ba1b95 100644 --- a/magnum/api/controllers/v1/cluster_template.py +++ b/magnum/api/controllers/v1/cluster_template.py @@ -141,7 +141,7 @@ class ClusterTemplate(base.APIBase): master_lb_enabled = wsme.wsattr(types.boolean, default=False) """Indicates whether created clusters should have a load balancer for master nodes or not. - """ + """ # noqa: E501 floating_ip_enabled = wsme.wsattr(types.boolean, default=True) """Indicates whether created clusters should have a floating ip or not.""" diff --git a/magnum/api/utils.py b/magnum/api/utils.py index 644cfdd0e7..f467f52991 100644 --- a/magnum/api/utils.py +++ b/magnum/api/utils.py @@ -86,7 +86,8 @@ def apply_jsonpatch(doc, patch): p['path'] == '/health_status_reason')): try: val = p['value'] - dict_val = val if type(val) == dict else ast.literal_eval(val) + dict_val = (val if isinstance(val, dict) + else ast.literal_eval(val)) p['value'] = dict_val except (SyntaxError, ValueError, AssertionError) as e: raise exception.PatchError(patch=patch, reason=e) diff --git a/magnum/hacking/checks.py b/magnum/hacking/checks.py index 7a02ef2e50..fe710b7bc6 100644 --- a/magnum/hacking/checks.py +++ b/magnum/hacking/checks.py @@ -93,7 +93,7 @@ def assert_equal_in(logical_line): """Check for assertEqual(True|False, A in B), assertEqual(A in B, True|False) M338 - """ + """ # noqa: E501 res = (assert_equal_in_start_with_true_or_false_re.search(logical_line) or assert_equal_in_end_with_true_or_false_re.search(logical_line)) if res: @@ -109,7 +109,7 @@ def no_xrange(logical_line): M339 """ if assert_xrange_re.match(logical_line): - yield(0, "M339: Do not use xrange().") + yield (0, "M339: Do not use xrange().") @core.flake8ext @@ -169,4 +169,4 @@ def check_explicit_underscore_import(logical_line, filename): UNDERSCORE_IMPORT_FILES.append(filename) elif (translated_log.match(logical_line) or string_translation.match(logical_line)): - yield(0, "M340: Found use of _() without explicit import of _ !") + yield (0, "M340: Found use of _() without explicit import of _ !") diff --git a/magnum/objects/x509keypair.py b/magnum/objects/x509keypair.py index f985276bcd..ce5d6d2a99 100644 --- a/magnum/objects/x509keypair.py +++ b/magnum/objects/x509keypair.py @@ -94,7 +94,7 @@ class X509KeyPair(base.MagnumPersistentObject, base.MagnumObject): :param uuid: the uuid of a x509keypair. :param context: Security context :returns: a :class:`X509KeyPair` object. - """ + """ # noqa: E501 db_x509keypair = cls.dbapi.get_x509keypair_by_uuid(context, uuid) x509keypair = X509KeyPair._from_db_object(cls(context), db_x509keypair) return x509keypair diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster_template.py b/magnum/tests/unit/api/controllers/v1/test_cluster_template.py index 62d9c87c36..50afae0e96 100644 --- a/magnum/tests/unit/api/controllers/v1/test_cluster_template.py +++ b/magnum/tests/unit/api/controllers/v1/test_cluster_template.py @@ -691,7 +691,7 @@ class TestPost(api_base.FunctionalTest): # Create mock for db and image data with mock.patch.object( self.dbapi, 'create_cluster_template', - wraps=self.dbapi.create_cluster_template) as cc_mock,\ + wraps=self.dbapi.create_cluster_template) as cc_mock, \ mock.patch('magnum.api.attr_validator.validate_image')\ as mock_image_data: mock_image_data.return_value = {'name': 'mock_name', diff --git a/magnum/tests/unit/api/controllers/v1/test_federation.py b/magnum/tests/unit/api/controllers/v1/test_federation.py index e394086643..c321e3ef81 100644 --- a/magnum/tests/unit/api/controllers/v1/test_federation.py +++ b/magnum/tests/unit/api/controllers/v1/test_federation.py @@ -206,7 +206,7 @@ class TestPatch(api_base.FunctionalTest): # make sure it was added: fed = self.get_json('/federations/%s' % f.uuid) - self.assertTrue(new_member.uuid in fed['member_ids']) + self.assertIn(new_member.uuid, fed['member_ids']) def test_member_unjoin(self): member = obj_utils.create_test_cluster(self.context) @@ -221,7 +221,7 @@ class TestPatch(api_base.FunctionalTest): # make sure it was deleted: fed = self.get_json('/federations/%s' % federation.uuid) - self.assertFalse(member.uuid in fed['member_ids']) + self.assertNotIn(member.uuid, fed['member_ids']) def test_join_non_existent_cluster(self): foo_uuid = uuidutils.generate_uuid() diff --git a/magnum/tests/unit/api/controllers/v1/test_quota.py b/magnum/tests/unit/api/controllers/v1/test_quota.py index 07e78857ed..88d72c2395 100644 --- a/magnum/tests/unit/api/controllers/v1/test_quota.py +++ b/magnum/tests/unit/api/controllers/v1/test_quota.py @@ -158,11 +158,11 @@ class TestQuota(api_base.FunctionalTest): expected = [r.project_id for r in quota_list[:2]] res_proj_ids = [r['project_id'] for r in response['quotas']] self.assertEqual(sorted(expected), sorted(res_proj_ids)) - self.assertTrue('http://localhost/v1/quotas?' in response['next']) - self.assertTrue('sort_key=id' in response['next']) - self.assertTrue('sort_dir=asc' in response['next']) - self.assertTrue('limit=2' in response['next']) - self.assertTrue('marker=%s' % quota_list[1].id in response['next']) + self.assertIn('http://localhost/v1/quotas?', response['next']) + self.assertIn('sort_key=id', response['next']) + self.assertIn('sort_dir=asc', response['next']) + self.assertIn('limit=2', response['next']) + self.assertIn('marker=%s' % quota_list[1].id, response['next']) @mock.patch("magnum.common.policy.enforce") @mock.patch("magnum.common.context.make_context") diff --git a/magnum/tests/unit/common/x509/test_operations.py b/magnum/tests/unit/common/x509/test_operations.py index 98e40f3e52..af67393554 100644 --- a/magnum/tests/unit/common/x509/test_operations.py +++ b/magnum/tests/unit/common/x509/test_operations.py @@ -46,5 +46,5 @@ class TestX509Operations(base.BaseTestCase): def test_generate_csr_and_key(self): csr_keys = operations.generate_csr_and_key(u"Test") self.assertIsNotNone(csr_keys) - self.assertTrue("public_key" in csr_keys) - self.assertTrue("private_key" in csr_keys) + self.assertIn("public_key", csr_keys) + self.assertIn("private_key", csr_keys) diff --git a/magnum/tests/unit/db/utils.py b/magnum/tests/unit/db/utils.py index 4ee5bf9e0a..ae937df41f 100644 --- a/magnum/tests/unit/db/utils.py +++ b/magnum/tests/unit/db/utils.py @@ -221,7 +221,7 @@ def create_test_magnum_service(**kw): :param kw: kwargs with overriding values for magnum_service's attributes. :returns: Test magnum_service DB object. - """ + """ # noqa: E501 magnum_service = get_test_magnum_service(**kw) # Let DB generate ID if it isn't specified explicitly if 'id' not in kw: diff --git a/requirements.txt b/requirements.txt index c02ab2f98d..8dffe8382c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,13 +2,6 @@ # date but we do not test them so no guarantee of having them all correct. If # you find any incorrect lower bounds, let us know or propose a fix. -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -# Despite above warning added by global sync process, please use -# ascii betical order. - PyYAML>=3.13 # MIT SQLAlchemy>=1.2.0 # MIT WSME>=0.8.0 # MIT diff --git a/test-requirements.txt b/test-requirements.txt index dcd2e89848..cb2db98226 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,16 +1,9 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -# Despite above warning added by global sync process, please use -# ascii betical order. - bandit!=1.6.0,>=1.1.0 # Apache-2.0 bashate>=2.0.0 # Apache-2.0 coverage>=5.3 # Apache-2.0 doc8>=0.8.1 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 oslotest>=4.4.1 # Apache-2.0 osprofiler>=3.4.0 # Apache-2.0 Pygments>=2.7.2 # BSD license