Fix functional tests and docs generation
First, fix test_help(). A commit[1], which first appeared in Python 3.10, changes the output of the help feature of argparse. Options used to be in a section named "Optional arguments:", and they are now in a section named "Options:". Second, tox 4 changes the behaviour of tox, and {toxinidir}/requirements.txt is no longer installed automagically in the docs virtual environment. This causes autodoc to fail on some imports. We explicitely add {toxinidir}/requirements.txt to the list of dependencies to fix this issue. These issues should be fixed in separate patches, but since they both block the CI, they depend on each other. [1] https://github.com/python/cpython/pull/23858 Change-Id: Ia7866390b31f469bdea95624325a13aaf45a496e Closes-Bug: #2002566
This commit is contained in:
parent
0bd9f80c67
commit
6c95122777
|
@ -51,7 +51,14 @@ class SimpleReadOnlyGlanceClientTest(base.ClientTestBase):
|
||||||
|
|
||||||
commands = []
|
commands = []
|
||||||
cmds_start = lines.index('Positional arguments:')
|
cmds_start = lines.index('Positional arguments:')
|
||||||
cmds_end = lines.index('Optional arguments:')
|
try:
|
||||||
|
# Starting in Python 3.10, argparse displays options in the
|
||||||
|
# "Options:" section...
|
||||||
|
cmds_end = lines.index('Options:')
|
||||||
|
except ValueError:
|
||||||
|
# ... but before Python 3.10, options were displayed in the
|
||||||
|
# "Optional arguments:" section.
|
||||||
|
cmds_end = lines.index('Optional arguments:')
|
||||||
command_pattern = re.compile(r'^ {4}([a-z0-9\-\_]+)')
|
command_pattern = re.compile(r'^ {4}([a-z0-9\-\_]+)')
|
||||||
for line in lines[cmds_start:cmds_end]:
|
for line in lines[cmds_start:cmds_end]:
|
||||||
match = command_pattern.match(line)
|
match = command_pattern.match(line)
|
||||||
|
|
|
@ -71,7 +71,14 @@ class SimpleReadOnlyGlanceClientTest(base.ClientTestBase):
|
||||||
|
|
||||||
commands = []
|
commands = []
|
||||||
cmds_start = lines.index('Positional arguments:')
|
cmds_start = lines.index('Positional arguments:')
|
||||||
cmds_end = lines.index('Optional arguments:')
|
try:
|
||||||
|
# Starting in Python 3.10, argparse displays options in the
|
||||||
|
# "Options:" section...
|
||||||
|
cmds_end = lines.index('Options:')
|
||||||
|
except ValueError:
|
||||||
|
# ... but before Python 3.10, options were displayed in the
|
||||||
|
# "Optional arguments:" section.
|
||||||
|
cmds_end = lines.index('Optional arguments:')
|
||||||
command_pattern = re.compile(r'^ {4}([a-z0-9\-\_]+)')
|
command_pattern = re.compile(r'^ {4}([a-z0-9\-\_]+)')
|
||||||
for line in lines[cmds_start:cmds_end]:
|
for line in lines[cmds_start:cmds_end]:
|
||||||
match = command_pattern.match(line)
|
match = command_pattern.match(line)
|
||||||
|
|
4
tox.ini
4
tox.ini
|
@ -54,7 +54,9 @@ commands =
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
deps = -r{toxinidir}/doc/requirements.txt
|
deps =
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
sphinx-build -W -b html doc/source doc/build/html
|
sphinx-build -W -b html doc/source doc/build/html
|
||||||
sphinx-build -W -b man doc/source doc/build/man
|
sphinx-build -W -b man doc/source doc/build/man
|
||||||
|
|
Loading…
Reference in New Issue