tox: Install extras

Install these via tox.ini when required. Note that we don't add them to
'test-requirements.txt' since packagers consume those and would be
forced to package these dependencies or modify this file.

A small bug in the tox file is corrected: you can't share an environment
directory if the dependencies in that directory are different. As such,
pep8 must go in its own directory again, not the 'shared' directory.

Change-Id: Iffb9ff2e300213ec01cccaf3b967e73331c9c9ff
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-12-22 17:18:19 +00:00
parent 86d87be8db
commit 4b2aa93158

31
tox.ini
View File

@ -29,6 +29,11 @@ deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
extras =
powervm
zvm
hyperv
vmware
passenv = passenv =
OS_DEBUG GENERATE_HASHES OS_DEBUG GENERATE_HASHES
# there is also secret magic in subunit-trace which lets you run in a fail only # there is also secret magic in subunit-trace which lets you run in a fail only
@ -42,16 +47,17 @@ commands =
description = description =
Run type checks. Run type checks.
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = commands =
bash tools/mypywrap.sh {posargs} bash tools/mypywrap.sh {posargs}
[testenv:pep8] [testenv:pep8]
description = description =
Run style checks. Run style checks.
envdir = {toxworkdir}/shared
deps = deps =
{[testenv]deps} {[testenv]deps}
autopep8 autopep8
extras =
commands = commands =
{[testenv:mypy]commands} {[testenv:mypy]commands}
# check if autopep8 would alter the formatting but don't actually change it # check if autopep8 would alter the formatting but don't actually change it
@ -68,6 +74,7 @@ commands =
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python' bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
[testenv:autopep8] [testenv:autopep8]
extras =
deps = autopep8 deps = autopep8
commands = commands =
autopep8 --exit-code --max-line-length=79 --in-place -r nova doc setup.py autopep8 --exit-code --max-line-length=79 --in-place -r nova doc setup.py
@ -76,6 +83,7 @@ commands =
description = description =
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8' Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = commands =
bash tools/flake8wrap.sh -HEAD bash tools/flake8wrap.sh -HEAD
@ -84,6 +92,7 @@ description =
Determine whether a backport is ready to be merged by checking whether it has Determine whether a backport is ready to be merged by checking whether it has
already been merged to master or more recent stable branches. already been merged to master or more recent stable branches.
deps = deps =
extras =
skipsdist = true skipsdist = true
commands = commands =
bash tools/check-cherry-picks.sh bash tools/check-cherry-picks.sh
@ -108,6 +117,7 @@ description =
deps = deps =
{[testenv]deps} {[testenv]deps}
openstack-placement>=1.0.0 openstack-placement>=1.0.0
extras =
commands = commands =
stestr --test-path=./nova/tests/functional run {posargs} stestr --test-path=./nova/tests/functional run {posargs}
stestr slowest stestr slowest
@ -116,6 +126,7 @@ commands =
description = description =
Run functional tests using python3.6. Run functional tests using python3.6.
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
{[testenv:functional]commands} {[testenv:functional]commands}
@ -123,6 +134,7 @@ commands =
description = description =
Run functional tests using python3.7. Run functional tests using python3.7.
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
{[testenv:functional]commands} {[testenv:functional]commands}
@ -130,6 +142,7 @@ commands =
description = description =
Run functional tests using python3.8. Run functional tests using python3.8.
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
{[testenv:functional]commands} {[testenv:functional]commands}
@ -140,6 +153,7 @@ description =
placement-nova-tox-functional-py38 job which is defined and placement-nova-tox-functional-py38 job which is defined and
run in placement. run in placement.
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
stestr --test-path=./nova/tests/functional run --exclude-regex '((?:api|notification)_sample_tests|functional\.db\.)' {posargs} stestr --test-path=./nova/tests/functional run --exclude-regex '((?:api|notification)_sample_tests|functional\.db\.)' {posargs}
@ -147,6 +161,7 @@ commands =
description = description =
Run functional tests using python3.9. Run functional tests using python3.9.
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
{[testenv:functional]commands} {[testenv:functional]commands}
@ -157,17 +172,20 @@ setenv =
GENERATE_SAMPLES=True GENERATE_SAMPLES=True
PYTHONHASHSEED=0 PYTHONHASHSEED=0
deps = {[testenv:functional]deps} deps = {[testenv:functional]deps}
extras =
commands = commands =
stestr --test-path=./nova/tests/functional/api_sample_tests run {posargs} stestr --test-path=./nova/tests/functional/api_sample_tests run {posargs}
stestr slowest stestr slowest
[testenv:genconfig] [testenv:genconfig]
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = commands =
oslo-config-generator --config-file=etc/nova/nova-config-generator.conf oslo-config-generator --config-file=etc/nova/nova-config-generator.conf
[testenv:genpolicy] [testenv:genpolicy]
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = commands =
oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
@ -180,6 +198,7 @@ envdir = {toxworkdir}/shared
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
PYTHON=coverage run --source nova --parallel-mode PYTHON=coverage run --source nova --parallel-mode
extras =
commands = commands =
coverage erase coverage erase
stestr run {posargs} stestr run {posargs}
@ -190,6 +209,7 @@ commands =
[testenv:debug] [testenv:debug]
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = commands =
oslo_debug_helper {posargs} oslo_debug_helper {posargs}
@ -197,6 +217,7 @@ commands =
deps = deps =
{[testenv]deps} {[testenv]deps}
-r{toxinidir}/doc/requirements.txt -r{toxinidir}/doc/requirements.txt
extras =
commands = commands =
{posargs} {posargs}
@ -208,6 +229,7 @@ description =
deps = deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt -r{toxinidir}/doc/requirements.txt
extras =
commands = commands =
rm -rf doc/build/html doc/build/doctrees rm -rf doc/build/html doc/build/doctrees
sphinx-build -W --keep-going -b html -j auto doc/source doc/build/html sphinx-build -W --keep-going -b html -j auto doc/source doc/build/html
@ -219,6 +241,7 @@ description =
Build PDF documentation. Build PDF documentation.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
extras =
commands = commands =
rm -rf doc/build/pdf rm -rf doc/build/pdf
sphinx-build -W --keep-going -b latex -j auto doc/source doc/build/pdf sphinx-build -W --keep-going -b latex -j auto doc/source doc/build/pdf
@ -229,6 +252,7 @@ description =
Generate the API guide. Called from CI scripts to test and publish to docs.openstack.org. Generate the API guide. Called from CI scripts to test and publish to docs.openstack.org.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
extras =
commands = commands =
rm -rf api-guide/build rm -rf api-guide/build
sphinx-build -W --keep-going -b html -j auto api-guide/source api-guide/build/html sphinx-build -W --keep-going -b html -j auto api-guide/source api-guide/build/html
@ -238,6 +262,7 @@ description =
Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org. Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
extras =
commands = commands =
rm -rf api-ref/build rm -rf api-ref/build
sphinx-build -W --keep-going -b html -j auto api-ref/source api-ref/build/html sphinx-build -W --keep-going -b html -j auto api-ref/source api-ref/build/html
@ -247,6 +272,7 @@ description =
Generate release notes. Generate release notes.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
extras =
commands = commands =
rm -rf releasenotes/build rm -rf releasenotes/build
sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html
@ -256,6 +282,7 @@ description =
Build all documentation including API guides and refs. Build all documentation including API guides and refs.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
extras =
commands = commands =
{[testenv:docs]commands} {[testenv:docs]commands}
{[testenv:api-guide]commands} {[testenv:api-guide]commands}
@ -266,6 +293,7 @@ commands =
# NOTE(browne): This is required for the integration test job of the bandit # NOTE(browne): This is required for the integration test job of the bandit
# project. Please do not remove. # project. Please do not remove.
envdir = {toxworkdir}/shared envdir = {toxworkdir}/shared
extras =
commands = bandit -r nova -x tests -n 5 -ll commands = bandit -r nova -x tests -n 5 -ll
[flake8] [flake8]
@ -358,6 +386,7 @@ paths =
# explicitly to avoid unnecessarily installing the checked-out repo too # explicitly to avoid unnecessarily installing the checked-out repo too
usedevelop = False usedevelop = False
deps = bindep deps = bindep
extras =
commands = commands =
bindep test bindep test