Python 3.10: Subcomand help test fix

In Python 3.10, "Optional arguments" becomes "Options". This
patch fixes that. FYI, this was reported against my Debian package:

https://bugs.debian.org/1002431

and currently, the package build against Python 3.9 and 3.10, so
I'm sure this patch works in both cases.

Change-Id: I76dc4077dde648d1a5589b49bf697470063ca2c1
This commit is contained in:
Thomas Goirand 2021-12-23 12:41:39 +01:00
parent 24edb142ae
commit 2284443ac9

View File

@ -101,10 +101,14 @@ class ShellTest(utils.TestCase):
matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
def test_help_on_subcommand(self):
if sys.version_info >= (3, 10):
options_name = 'Options'
else:
options_name = 'Optional arguments'
required = [
r'.*?^usage: zun create',
r'.*?^Create a container.',
r'.*?^Optional arguments:',
r'.*?^' + options_name + ':',
]
stdout, stderr = self.shell('help create')
for r in required: