diff options
author | Zuul <zuul@review.opendev.org> | 2022-12-12 23:13:37 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-12-12 23:13:37 +0000 |
commit | 9a4a7868b85b025ef68ab5c0e3c0c4d852400f3b (patch) | |
tree | 829d5ecbf47089e3108109ced30cb6e04c86a8d4 | |
parent | 594317f163c5643e9f9d8c4a89f25bcba907aee1 (diff) | |
parent | 90eb9d2be62b5eef179edc7d5ab2cb424a6119e0 (diff) | |
download | python-cinderclient-9a4a7868b85b025ef68ab5c0e3c0c4d852400f3b.tar.gz |
Merge "Python3.11: Fix argparse-related test failures"
-rw-r--r-- | cinderclient/tests/unit/test_shell.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py index 682d509..8f236c6 100644 --- a/cinderclient/tests/unit/test_shell.py +++ b/cinderclient/tests/unit/test_shell.py @@ -376,7 +376,7 @@ class TestLoadVersionedActions(utils.TestCase): self.mock_completion() - def test_load_versioned_actions(self): + def test_load_versioned_actions_v3_0(self): parser = cinderclient.shell.CinderClientArgumentParser() subparsers = parser.add_subparsers(metavar='<subcommand>') shell = cinderclient.shell.OpenStackCinderShell() @@ -388,6 +388,10 @@ class TestLoadVersionedActions(utils.TestCase): "fake_action 3.0 to 3.1", shell.subcommands['fake-action'].get_default('func')()) + def test_load_versioned_actions_v3_2(self): + parser = cinderclient.shell.CinderClientArgumentParser() + subparsers = parser.add_subparsers(metavar='<subcommand>') + shell = cinderclient.shell.OpenStackCinderShell() shell.subcommands = {} shell._find_actions(subparsers, fake_actions_module, api_versions.APIVersion("3.2"), False, []) @@ -521,7 +525,7 @@ class TestLoadVersionedActions(utils.TestCase): @mock.patch.object(cinderclient.shell.CinderClientArgumentParser, 'add_argument') - def test_load_actions_with_versioned_args(self, mock_add_arg): + def test_load_actions_with_versioned_args_v36(self, mock_add_arg): parser = cinderclient.shell.CinderClientArgumentParser(add_help=False) subparsers = parser.add_subparsers(metavar='<subcommand>') shell = cinderclient.shell.OpenStackCinderShell() @@ -533,8 +537,13 @@ class TestLoadVersionedActions(utils.TestCase): self.assertNotIn(mock.call('--foo', help="second foo"), mock_add_arg.call_args_list) - mock_add_arg.reset_mock() - + @mock.patch.object(cinderclient.shell.CinderClientArgumentParser, + 'add_argument') + def test_load_actions_with_versioned_args_v39(self, mock_add_arg): + parser = cinderclient.shell.CinderClientArgumentParser(add_help=False) + subparsers = parser.add_subparsers(metavar='<subcommand>') + shell = cinderclient.shell.OpenStackCinderShell() + shell.subcommands = {} shell._find_actions(subparsers, fake_actions_module, api_versions.APIVersion("3.9"), False, []) self.assertNotIn(mock.call('--foo', help="first foo"), |