diff options
author | Cyril Roelandt <cyril@redhat.com> | 2022-12-16 04:56:02 +0100 |
---|---|---|
committer | Cyril Roelandt <cyril@redhat.com> | 2023-01-12 14:05:25 +0100 |
commit | 6c95122777c8449056115292b492ec3e1e0d6e50 (patch) | |
tree | 2f6733b2ee43e1031c68bc7db2953f10fd1d4d8b /glanceclient/tests | |
parent | 0bd9f80c6791ec7842f124295a76b00cf781c767 (diff) | |
download | python-glanceclient-6c95122777c8449056115292b492ec3e1e0d6e50.tar.gz |
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
Diffstat (limited to 'glanceclient/tests')
-rw-r--r-- | glanceclient/tests/functional/v1/test_readonly_glance.py | 9 | ||||
-rw-r--r-- | glanceclient/tests/functional/v2/test_readonly_glance.py | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/glanceclient/tests/functional/v1/test_readonly_glance.py b/glanceclient/tests/functional/v1/test_readonly_glance.py index a7024aa..ffd8358 100644 --- a/glanceclient/tests/functional/v1/test_readonly_glance.py +++ b/glanceclient/tests/functional/v1/test_readonly_glance.py @@ -51,7 +51,14 @@ class SimpleReadOnlyGlanceClientTest(base.ClientTestBase): commands = [] 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\-\_]+)') for line in lines[cmds_start:cmds_end]: match = command_pattern.match(line) diff --git a/glanceclient/tests/functional/v2/test_readonly_glance.py b/glanceclient/tests/functional/v2/test_readonly_glance.py index 4d7f92d..7bc86d1 100644 --- a/glanceclient/tests/functional/v2/test_readonly_glance.py +++ b/glanceclient/tests/functional/v2/test_readonly_glance.py @@ -71,7 +71,14 @@ class SimpleReadOnlyGlanceClientTest(base.ClientTestBase): commands = [] 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\-\_]+)') for line in lines[cmds_start:cmds_end]: match = command_pattern.match(line) |