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
1 changed files with 30 additions and 1 deletions

31
tox.ini
View File

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