Skip to content
Snippets Groups Projects
Commit 972aff0f authored by Felipe Reyes's avatar Felipe Reyes
Browse files

Fix test_help_on_subcommand on Python 3.10

Python 3.10 changed the way the optional arguments defined in argparse
are listed in the help output, the title was changed from "Optional
arguments" to "Options".

This checks the python version where the unit test is being executed and
uses the string that corresponds.

Story: 2009946
Task: 44858
Change-Id: Ibee09bf76399849f7da987c4661fa1945d27afb7
parent f279da43
Branches
Tags
No related merge requests found
......@@ -119,9 +119,13 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand(self):
required = [
'.*?^usage: magnum bay-create',
'.*?^Create a bay.',
'.*?^Optional arguments:',
'.*?^Create a bay.'
]
# https://bugs.python.org/issue9694
if sys.version_info[:2] >= (3, 10):
required.append('.*?^Options:')
else:
required.append('.*?^Optional arguments:')
stdout, stderr = self.shell('help bay-create')
for r in required:
self.assertThat((stdout + stderr),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment