diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08aef91b..9b908c6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: - id: flake8 name: flake8 additional_dependencies: - - hacking>=3.0.1,<3.1.0 + - hacking>=6.1.0,<6.2.0 language: python entry: flake8 files: '^.*\.py$' diff --git a/castellan/_config_driver.py b/castellan/_config_driver.py index 26fdb0a2..a7665f12 100644 --- a/castellan/_config_driver.py +++ b/castellan/_config_driver.py @@ -95,7 +95,7 @@ class CastellanConfigurationSourceDriver(sources.ConfigurationSourceDriver): class CastellanConfigurationSource(sources.ConfigurationSource): - """A configuration source for configuration values served through castellan. + """A configuration source for configuration values served through castellan. # noqa :param config_file: The path to a castellan configuration file. diff --git a/castellan/common/objects/managed_object.py b/castellan/common/objects/managed_object.py index 35d8f841..42179378 100644 --- a/castellan/common/objects/managed_object.py +++ b/castellan/common/objects/managed_object.py @@ -40,7 +40,7 @@ class ManagedObject(object, metaclass=abc.ABCMeta): self._name = name # If None or POSIX times - if not created or type(created) == int: + if not created or isinstance(created, int): self._created = created else: raise ValueError('created must be of long type, actual type %s' % diff --git a/castellan/tests/functional/key_manager/test_key_manager.py b/castellan/tests/functional/key_manager/test_key_manager.py index 062c7eac..abacb315 100644 --- a/castellan/tests/functional/key_manager/test_key_manager.py +++ b/castellan/tests/functional/key_manager/test_key_manager.py @@ -194,7 +194,7 @@ class KeyManagerTestCase(object): # created if older objects were not cleaned up, so we will simply # check if the object we created is in the list retrieved_objects = self.key_mgr.list(self.ctxt) - self.assertTrue(managed_object in retrieved_objects) + self.assertIn(managed_object, retrieved_objects) for retrieved_object in retrieved_objects: self.assertFalse(retrieved_object.is_metadata_only()) self.assertIsNotNone(retrieved_object.id) @@ -217,7 +217,7 @@ class KeyManagerTestCase(object): # created if older objects were not cleaned up, so we will simply # check if the object we created is in the list retrieved_objects = self.key_mgr.list(self.ctxt, metadata_only=True) - self.assertTrue(expected_obj in retrieved_objects) + self.assertIn(expected_obj, retrieved_objects) for retrieved_object in retrieved_objects: self.assertTrue(retrieved_object.is_metadata_only()) self.assertIsNotNone(retrieved_object.id) @@ -242,4 +242,4 @@ class KeyManagerTestCase(object): for retrieved_object in retrieved_objects: self.assertEqual(type(object_1), type(retrieved_object)) self.assertIsNotNone(retrieved_object.id) - self.assertTrue(object_1 in retrieved_objects) + self.assertIn(object_1, retrieved_objects) diff --git a/castellan/tests/unit/key_manager/mock_key_manager.py b/castellan/tests/unit/key_manager/mock_key_manager.py index 89dccee9..ab463834 100644 --- a/castellan/tests/unit/key_manager/mock_key_manager.py +++ b/castellan/tests/unit/key_manager/mock_key_manager.py @@ -256,6 +256,6 @@ class MockKeyManager(key_manager.KeyManager): objects = [] for obj_id in self.keys: obj = self.get(context, obj_id, metadata_only=metadata_only) - if type(obj) == object_type or object_type is None: + if object_type is None or isinstance(obj, object_type): objects.append(obj) return objects diff --git a/castellan/tests/unit/key_manager/test_mock_key_manager.py b/castellan/tests/unit/key_manager/test_mock_key_manager.py index aef41559..d03e756f 100644 --- a/castellan/tests/unit/key_manager/test_mock_key_manager.py +++ b/castellan/tests/unit/key_manager/test_mock_key_manager.py @@ -229,8 +229,8 @@ class MockKeyManagerTestCase(test_key_mgr.KeyManagerTestCase): keys = self.key_mgr.list(self.context) self.assertEqual(2, len(keys)) - self.assertTrue(key1 in keys) - self.assertTrue(key2 in keys) + self.assertIn(key1, keys) + self.assertIn(key2, keys) for key in keys: self.assertIsNotNone(key.id) @@ -246,7 +246,7 @@ class MockKeyManagerTestCase(test_key_mgr.KeyManagerTestCase): bit_length_list = [key1.bit_length, key2.bit_length] for key in keys: self.assertTrue(key.is_metadata_only()) - self.assertTrue(key.bit_length in bit_length_list) + self.assertIn(key.bit_length, bit_length_list) for key in keys: self.assertIsNotNone(key.id) diff --git a/requirements.txt b/requirements.txt index 5dcca67d..24adf8bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +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. - pbr!=2.1.0,>=2.0.0 # Apache-2.0 cryptography>=2.7 # BSD/Apache-2.0 python-barbicanclient>=5.5.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 9d949b0b..54c3fcba 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,4 @@ -# 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. -hacking>=3.0.1,<3.1.0 # Apache-2.0 -# remove this pyflakes from here once you bump the -# hacking to 3.2.0 or above. hacking 3.2.0 takes -# care of pyflakes version compatibilty. -pyflakes>=2.1.1 +hacking>=6.1.0,<6.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 python-barbicanclient>=4.5.2 # Apache-2.0