diff options
author | Cyril Roelandt <cyril@redhat.com> | 2022-07-28 20:14:36 +0200 |
---|---|---|
committer | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2022-12-21 13:31:33 +0000 |
commit | 20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130 (patch) | |
tree | 0977c66867cc1c918964d693755461e25fd3698f | |
parent | 9a4a7868b85b025ef68ab5c0e3c0c4d852400f3b (diff) | |
download | python-cinderclient-20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130.tar.gz |
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
Closes-Bug: #1983047
Change-Id: If20abef109ddd7107c83b5886beb666a6550a640
-rw-r--r-- | cinderclient/tests/unit/test_shell.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py index 8f236c6..4808689 100644 --- a/cinderclient/tests/unit/test_shell.py +++ b/cinderclient/tests/unit/test_shell.py @@ -120,9 +120,9 @@ class ShellTest(utils.TestCase): # 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 @@ class ShellTest(utils.TestCase): 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 @@ class ShellTest(utils.TestCase): 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 @@ class ShellTest(utils.TestCase): 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: |