Fix functional tests failing with python 3.10

argparse module had a change [1] in header text denoting optional
arguments. The header text now reads "options" instead of
"optional arguments"

[1] https://docs.python.org/3/whatsnew/3.10.html#argparse
Closes-Bug: #2000092

Change-Id: I2d7caa6e3c5a6a493639dc655a6722992540281e
This commit is contained in:
Goutham Pacha Ravi 2022-12-19 12:36:57 -08:00
parent cb78d0e17b
commit cb14e965ef

View File

@ -35,7 +35,11 @@ class ManilaClientTestCommonReadOnly(base.BaseTestCase):
commands = []
cmds_start = lines.index('Positional arguments:')
cmds_end = lines.index('Optional arguments:')
try:
# TODO(gouthamr): Drop when py3.10 becomes min supported version
cmds_end = lines.index('Optional arguments:')
except ValueError:
cmds_end = lines.index('Options:')
command_pattern = re.compile(r'^ {4}([a-z0-9\-\_]+)')
for line in lines[cmds_start:cmds_end]:
match = command_pattern.match(line)