Debian Patches

Status for python-cinderclient/1:9.1.0-3

Patch Description Author Forwarded Bugs Origin Last update
py3.11-fix_argparse_related_test_failures.patch Python3.11: Fix argparse-related test failures In Python3.11, the following code crashes:
.
$ cat test.py
import argparse
.
parser = argparse.ArgumentParser(description='Short sample app')
subparsers = parser.add_subparsers()
subparsers.add_parser('foo')
subparsers.add_parser('foo')
.
$ python3.11 test.py
Traceback (most recent call last):
File "/tmp/arg.py", line 6, in <module>
subparsers.add_parser('foo')
File "/usr/lib/python3.11/argparse.py", line 1197, in add_parser
raise ArgumentError(self, _('conflicting subparser: %s') % name)
argparse.ArgumentError: argument {foo}: conflicting subparser: foo
.
It is now forbidden to use add_parser() multiple times with the same
arguments, which is exactly what we do in the following tests:
.
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_versioned_actions
- cinderclient.tests.unit.test_shell.TestLoadVersionedActions.test_load_actions_with_versioned_args
.
In order to fix the tests failures, we make sure to reset the parser and
subparsers before calling add_parser().
.
While not strictly necessary, we split those tests into two functions,
for readability purposes.

diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index 682d509..8f236c6 100644
Cyril Roelandt <cyril@redhat.com> no upstream, https://review.opendev.org/c/openstack/python-cinderclient/+/851467 2022-12-12
py3.11_fix_crashes_in_ShellTest.patch Python3.11: fix crashes in ShellTest In Python3.11, global flags must be placed right at the start of a
regular expression.
.
The following regex:
.
r'.*?(?m)^Lists all volumes.',
must become:
.
r'(?m).*?^Lists all volumes.',
.
However, since we are using re.MULTILINE, we actually do not need to use
a global flag.
.
This commit fixes the following tests in Python3.11:
- cinderclient.tests.unit.test_shell.ShellTest.test_help_arg_no_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand
- cinderclient.tests.unit.test_shell.ShellTest.test_help_on_subcommand_mv

diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index 682d509..320af69 100644
Cyril Roelandt <cyril@redhat.com> no upstream, https://review.opendev.org/c/openstack/python-cinderclient/+/851446 2022-12-12

All known versions for source package 'python-cinderclient'

Links