diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-11-12 12:29:20 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-11-12 13:59:19 +0200 |
commit | abde8b8c0c4b50a8a0b4e0d97c9d7911271c4eb9 (patch) | |
tree | 9c9e706b0def24eb836535de0c62ebabba6a86dd /dev-python | |
parent | dev-python/bandit: enable py3.11 (diff) | |
download | gentoo-abde8b8c0c4b50a8a0b4e0d97c9d7911271c4eb9.tar.gz gentoo-abde8b8c0c4b50a8a0b4e0d97c9d7911271c4eb9.tar.bz2 gentoo-abde8b8c0c4b50a8a0b4e0d97c9d7911271c4eb9.zip |
dev-python/python-cinderclient: enable py3.11
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python')
3 files changed, 113 insertions, 1 deletions
diff --git a/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-argparse.patch b/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-argparse.patch new file mode 100644 index 000000000000..863e4d93b298 --- /dev/null +++ b/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-argparse.patch @@ -0,0 +1,54 @@ +https://review.opendev.org/c/openstack/python-cinderclient/+/851467 +From: Cyril Roelandt <cyril@redhat.com> +Date: Thu, 28 Jul 2022 20:48:58 +0200 +Subject: [PATCH] Python3.11: Fix argparse-related test failures + +Closes-Bug: #1983054 +Change-Id: I2d4cb81a394f3c10e5f01945d894746a904fb5df +--- a/cinderclient/tests/unit/test_shell.py ++++ b/cinderclient/tests/unit/test_shell.py +@@ -376,7 +376,7 @@ + + 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 @@ + "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 @@ + + @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 @@ + 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"), diff --git a/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-crashes.patch b/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-crashes.patch new file mode 100644 index 000000000000..3f86c3a50ade --- /dev/null +++ b/dev-python/python-cinderclient/files/python-cinderclient-9.1.0-fix-py3.11-crashes.patch @@ -0,0 +1,53 @@ +https://review.opendev.org/c/openstack/python-cinderclient/+/851446 +From: Cyril Roelandt <cyril@redhat.com> +Date: Thu, 28 Jul 2022 20:14:36 +0200 +Subject: [PATCH] Python3.11: fix crashes in ShellTest + +Closes-Bug: #1983047 +Change-Id: If20abef109ddd7107c83b5886beb666a6550a640 +--- a/cinderclient/tests/unit/test_shell.py ++++ b/cinderclient/tests/unit/test_shell.py +@@ -120,9 +120,9 @@ + # Some expected help output, including microversioned commands + required = [ + r'.*?^usage: ', +- r'.*?(?m)^\s+create\s+Creates a volume.', +- r'.*?(?m)^\s+summary\s+Get volumes summary.', +- r'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', ++ r'.*?^\s+create\s+Creates a volume.', ++ r'.*?^\s+summary\s+Get volumes summary.', ++ r'.*?^Run "cinder help SUBCOMMAND" for help on a subcommand.', + ] + help_text = self.shell('help') + for r in required: +@@ -132,7 +132,7 @@ + def test_help_on_subcommand(self): + required = [ + r'.*?^usage: cinder list', +- r'.*?(?m)^Lists all volumes.', ++ r'.*?^Lists all volumes.', + ] + help_text = self.shell('help list') + for r in required: +@@ -142,7 +142,7 @@ + def test_help_on_subcommand_mv(self): + required = [ + r'.*?^usage: cinder summary', +- r'.*?(?m)^Get volumes summary.', ++ r'.*?^Get volumes summary.', + ] + help_text = self.shell('help summary') + for r in required: +@@ -152,9 +152,9 @@ + def test_help_arg_no_subcommand(self): + required = [ + r'.*?^usage: ', +- r'.*?(?m)^\s+create\s+Creates a volume.', +- r'.*?(?m)^\s+summary\s+Get volumes summary.', +- r'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', ++ r'.*?^\s+create\s+Creates a volume.', ++ r'.*?^\s+summary\s+Get volumes summary.', ++ r'.*?^Run "cinder help SUBCOMMAND" for help on a subcommand.', + ] + help_text = self.shell('--os-volume-api-version 3.40') + for r in required: diff --git a/dev-python/python-cinderclient/python-cinderclient-9.1.0.ebuild b/dev-python/python-cinderclient/python-cinderclient-9.1.0.ebuild index 6aa69f0ac442..1195ce14c1c5 100644 --- a/dev-python/python-cinderclient/python-cinderclient-9.1.0.ebuild +++ b/dev-python/python-cinderclient/python-cinderclient-9.1.0.ebuild @@ -4,7 +4,7 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{8..11} ) inherit distutils-r1 @@ -39,6 +39,11 @@ BDEPEND=" ) " +PATCHES=( + "${FILESDIR}/${P}-fix-py3.11-argparse.patch" + "${FILESDIR}/${P}-fix-py3.11-crashes.patch" +) + distutils_enable_tests unittest python_test() { |