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
This commit is contained in:
parent
f279da4399
commit
972aff0f32
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user