From 5a2c000557c7e4fb2db0c6702ad8d556208a3f5b Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 27 Jan 2024 23:27:29 +0900 Subject: [PATCH] Bump hacking hacking 3.0.x is too old. Change-Id: I1fa5bf30150c4d6fa38d4103f652fb6b82963cf3 --- manilaclient/common/cliutils.py | 4 ++-- manilaclient/tests/functional/base.py | 2 +- manilaclient/tests/functional/osc/base.py | 2 +- manilaclient/tests/functional/osc/test_resource_locks.py | 8 ++++---- .../tests/functional/osc/test_share_access_rules.py | 4 ++-- manilaclient/tests/unit/fakes.py | 2 +- manilaclient/tests/unit/v2/fakes.py | 2 +- manilaclient/tests/unit/v2/test_limits.py | 4 ++-- manilaclient/tests/unit/v2/test_share_networks.py | 4 ++-- manilaclient/v2/shell.py | 1 + test-requirements.txt | 2 +- 11 files changed, 18 insertions(+), 17 deletions(-) diff --git a/manilaclient/common/cliutils.py b/manilaclient/common/cliutils.py index 10c5ad986..552653a59 100644 --- a/manilaclient/common/cliutils.py +++ b/manilaclient/common/cliutils.py @@ -251,8 +251,8 @@ def get_service_type(f): return getattr(f, 'service_type', None) -def pretty_choice_list(l): - return ', '.join("'%s'" % i for i in l) +def pretty_choice_list(choices): + return ', '.join("'%s'" % choice for choice in choices) def exit(msg=''): diff --git a/manilaclient/tests/functional/base.py b/manilaclient/tests/functional/base.py index 522942940..97709731f 100644 --- a/manilaclient/tests/functional/base.py +++ b/manilaclient/tests/functional/base.py @@ -98,7 +98,7 @@ class BaseTestCase(base.ClientTestBase): res["deleted"] = False if "client" not in res: res["client"] = cls.get_cleanup_client() - if not(res["deleted"]): + if not res["deleted"]: res_id = res["id"] client = res["client"] deletion_params = res.get("deletion_params") diff --git a/manilaclient/tests/functional/osc/base.py b/manilaclient/tests/functional/osc/base.py index d86322f6c..91e955997 100644 --- a/manilaclient/tests/functional/osc/base.py +++ b/manilaclient/tests/functional/osc/base.py @@ -422,7 +422,7 @@ class OSCClientTestBase(base.ClientTestBase): if availability_zone: cmd += f' --availability-zone {availability_zone}' if restart_check: - cmd += f' --restart-check' + cmd += ' --restart-check' check_result = self.dict_result('share', cmd) return check_result diff --git a/manilaclient/tests/functional/osc/test_resource_locks.py b/manilaclient/tests/functional/osc/test_resource_locks.py index 1635b8081..e7c9cd188 100644 --- a/manilaclient/tests/functional/osc/test_resource_locks.py +++ b/manilaclient/tests/functional/osc/test_resource_locks.py @@ -109,7 +109,7 @@ class ResourceLockTests(base.OSCClientTestBase): 'lock list --lock-context user ' f' --resource {self.share["id"]}') self.assertEqual(2, len(locks)) - self.assertNotIn(lock_3['id'], [l['ID'] for l in locks]) + self.assertNotIn(lock_3['id'], [lock['ID'] for lock in locks]) locks = self.listing_result('share', 'lock list --lock-context user' @@ -118,9 +118,9 @@ class ResourceLockTests(base.OSCClientTestBase): ' --sort-dir desc ' ' --limit 1') self.assertEqual(1, len(locks)) - self.assertIn(lock_2['id'], [l['ID'] for l in locks]) - self.assertNotIn(lock_1['id'], [l['ID'] for l in locks]) - self.assertNotIn(lock_3['id'], [l['ID'] for l in locks]) + self.assertIn(lock_2['id'], [lock['ID'] for lock in locks]) + self.assertNotIn(lock_1['id'], [lock['ID'] for lock in locks]) + self.assertNotIn(lock_3['id'], [lock['ID'] for lock in locks]) def test_lock_set_unset_lock_reason(self): lock = self.create_resource_lock(self.share['id'], diff --git a/manilaclient/tests/functional/osc/test_share_access_rules.py b/manilaclient/tests/functional/osc/test_share_access_rules.py index 38e832e65..38ef011fb 100644 --- a/manilaclient/tests/functional/osc/test_share_access_rules.py +++ b/manilaclient/tests/functional/osc/test_share_access_rules.py @@ -186,7 +186,7 @@ class ListShareAccessRulesTestCase(base.OSCClientTestBase): output = self.openstack( 'share', params=f'access list {share["id"]} --access-to {access_to_filter}', - flags=f'--os-share-api-version 2.82') + flags='--os-share-api-version 2.82') access_rule_list = self.parser.listing(output) self.assertTrue(len(access_rule_list) == 1) @@ -214,7 +214,7 @@ class ShowShareAccessRulesTestCase(base.OSCClientTestBase): self.assertEqual(access_rule_show['created_at'], access_rule['created_at']) self.assertEqual(access_rule_show['properties'], '') - self.assertTrue('updated_at' in access_rule_show) + self.assertIn('updated_at', access_rule_show) class SetShareAccessTestCase(base.OSCClientTestBase): diff --git a/manilaclient/tests/unit/fakes.py b/manilaclient/tests/unit/fakes.py index 165a16d10..01c29972c 100644 --- a/manilaclient/tests/unit/fakes.py +++ b/manilaclient/tests/unit/fakes.py @@ -65,7 +65,7 @@ class FakeClient(object): break assert found, 'Expected %s %s; got %s' % ( - expected, self.client.callstack) + expected[0], expected[1], self.client.callstack) if body is not None: try: diff --git a/manilaclient/tests/unit/v2/fakes.py b/manilaclient/tests/unit/v2/fakes.py index 7c3c1c407..fa75d80c1 100644 --- a/manilaclient/tests/unit/v2/fakes.py +++ b/manilaclient/tests/unit/v2/fakes.py @@ -1087,7 +1087,7 @@ class FakeHTTPClient(fakes.FakeHTTPClient): return (200, {}, {'extra_specs': {'k': 'v'}}) def delete_types_1_extra_specs_k(self, **kw): - return(204, {}, None) + return (204, {}, None) def delete_types_1(self, **kw): return (202, {}, None) diff --git a/manilaclient/tests/unit/v2/test_limits.py b/manilaclient/tests/unit/v2/test_limits.py index f0e4ae3f4..6e38aa40a 100644 --- a/manilaclient/tests/unit/v2/test_limits.py +++ b/manilaclient/tests/unit/v2/test_limits.py @@ -160,5 +160,5 @@ class TestLimitsManager(utils.TestCase): api.client.get.assert_called_once_with('/limits') self.assertIsInstance(lim, limits.Limits) - for l in lim.absolute: - self.assertEqual(l1, l) + for li in lim.absolute: + self.assertEqual(l1, li) diff --git a/manilaclient/tests/unit/v2/test_share_networks.py b/manilaclient/tests/unit/v2/test_share_networks.py index fdba2d478..3380c3dcd 100644 --- a/manilaclient/tests/unit/v2/test_share_networks.py +++ b/manilaclient/tests/unit/v2/test_share_networks.py @@ -50,7 +50,7 @@ class ShareNetworkTest(utils.TestCase): api_version = api_versions.APIVersion(microversion) values = self.values.copy() if (api_version >= api_versions.APIVersion("2.26")): - del(values['nova_net_id']) + del values['nova_net_id'] body_expected = {share_networks.RESOURCE_NAME: values} manager = share_networks.ShareNetworkManager( @@ -123,7 +123,7 @@ class ShareNetworkTest(utils.TestCase): api_version = api_versions.APIVersion(microversion) values = self.values.copy() if (api_version >= api_versions.APIVersion("2.26")): - del(values['nova_net_id']) + del values['nova_net_id'] body_expected = {share_networks.RESOURCE_NAME: values} manager = share_networks.ShareNetworkManager( diff --git a/manilaclient/v2/shell.py b/manilaclient/v2/shell.py index c2f0fae13..b09235af6 100644 --- a/manilaclient/v2/shell.py +++ b/manilaclient/v2/shell.py @@ -4884,6 +4884,7 @@ def do_extend(cs, args): share = _find_share(cs, args.share) _print_share(cs, share) + @cliutils.arg('share', metavar='', help='Name or ID of share to shrink.') @cliutils.arg('new_size', diff --git a/test-requirements.txt b/test-requirements.txt index 6a9d95225..aae70c7b6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT