From c33d3958114cf38594679e209a5325c2779e4426 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Fri, 3 Sep 2021 10:15:18 +0200 Subject: [PATCH] Dependency reorganization By adjusting the way we manage our tox dependencies and increasing the number of mocked submodules during test runs and doc building, we can minimize issues stemming from unexpected changes to constraints. Patch also includes some style changes in the tox.ini file, to harmonize the format of format definitions. Closes-Bug: #1942508 Signed-off-by: Jiri Podivin Change-Id: I73009d251f2c2a333903c02ab1c07c99247f73ab --- doc/source/conf.py | 6 +++++- test-requirements.txt | 5 ++--- tox.ini | 25 +++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 9829dd4..53e7506 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,6 +15,7 @@ import os import sys +from unittest import mock # Add the project sys.path.insert(0, os.path.abspath('../..')) @@ -50,7 +51,10 @@ openstackdocs_bug_tag = 'documentation' # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable -autodoc_mock_imports = ['validations_libs', 'oslotest'] +autodoc_mock_imports = ['validations_libs', 'oslotest', 'ansible'] + +# Mocking autodoc deps manually +sys.modules['ansible.module_utils.basic'] = mock.Mock() # The suffix of source filenames. source_suffix = '.rst' diff --git a/test-requirements.txt b/test-requirements.txt index 66526ab..486e2e3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,8 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -openstackdocstheme>=1.20.0 # Apache-2.0 - +ansible>=2.8,!=2.8.9,!=2.9.12,<2.10.0 # GPLv3+ coverage!=4.4,>=4.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=3.0.1 # Apache-2.0 @@ -11,4 +10,4 @@ testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT reno>=2.5.0 # Apache-2.0 netaddr>=0.7.18 # BSD -pre-commit # MIT +pre-commit>=2.3.0 # MIT diff --git a/tox.ini b/tox.ini index d96d709..47ea250 100644 --- a/tox.ini +++ b/tox.ini @@ -35,11 +35,9 @@ setenv = commands = stestr run --slowest --color {posargs} deps = - -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} - -r {toxinidir}/requirements.txt - -r {toxinidir}/test-requirements.txt - -r {toxinidir}/molecule-requirements.txt - -r {toxinidir}/doc/requirements.txt + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + -r {toxinidir}/doc/requirements.txt whitelist_externals = bash [testenv:py27] @@ -54,10 +52,10 @@ commands_pre = commands = python2.7 -m unittest discover -s {envtmpdir}/validations_common/tests deps = - -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/train/upper-constraints.txt} - -r {toxinidir}/requirements.txt - -r {toxinidir}/test-requirements.txt - ansible>=2 + -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train} + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt + ansible>=2 whitelist_externals = bash cp @@ -116,9 +114,9 @@ commands = [testenv:linters] deps = - -r {toxinidir}/requirements.txt - -r {toxinidir}/test-requirements.txt - -r {toxinidir}/molecule-requirements.txt + -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r {toxinidir}/requirements.txt + -r {toxinidir}/test-requirements.txt commands = python '{toxinidir}/tools/validate-files.py' . {[testenv:ansible-lint]commands} @@ -150,9 +148,8 @@ commands = [testenv:docs] deps = - -c {env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} + -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r {toxinidir}/doc/requirements.txt - -r {toxinidir}/molecule-requirements.txt commands= sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T doc8 doc