tox: Reuse envdirs

This massively reduces the amount of time needed to install dependencies
and saves a lot of disk space to boot #winning

Note that it's not possible to use 'envdir = {[testenv:py27]envdir}' as
that syntax doesn't work with implicit attributes.

Change-Id: I229e1961a66db08be2d4f7235d2c3724e875f13b
This commit is contained in:
Stephen Finucane
2018-06-28 15:16:26 +01:00
parent 7601b3bb7f
commit df669cafa5
+15
View File
@@ -54,6 +54,7 @@ commands =
description = description =
Run style checks. Run style checks.
deps = {[testenv]deps} deps = {[testenv]deps}
envdir = {toxworkdir}/venv
commands = commands =
bash tools/flake8wrap.sh {posargs} bash tools/flake8wrap.sh {posargs}
# Check that all JSON files don't have \r\n in line. # Check that all JSON files don't have \r\n in line.
@@ -64,6 +65,7 @@ commands =
[testenv:fast8] [testenv:fast8]
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}/venv
commands = commands =
bash tools/flake8wrap.sh -HEAD bash tools/flake8wrap.sh -HEAD
@@ -71,6 +73,7 @@ commands =
# TODO(melwitt): This can be removed when functional tests are gating with # TODO(melwitt): This can be removed when functional tests are gating with
# python 3.x # python 3.x
basepython = python2.7 basepython = python2.7
envdir = {toxworkdir}/py27
setenv = {[testenv]setenv} setenv = {[testenv]setenv}
commands = commands =
{[testenv]commands} {[testenv]commands}
@@ -89,11 +92,13 @@ commands =
# with python 3.5 # with python 3.5
[testenv:functional-py35] [testenv:functional-py35]
basepython = python3.5 basepython = python3.5
envdir = {toxworkdir}/py35
setenv = {[testenv]setenv} setenv = {[testenv]setenv}
commands = commands =
{[testenv:functional]commands} {[testenv:functional]commands}
[testenv:api-samples] [testenv:api-samples]
envdir = {toxworkdir}/venv
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
GENERATE_SAMPLES=True GENERATE_SAMPLES=True
@@ -104,14 +109,17 @@ commands =
stestr slowest stestr slowest
[testenv:genconfig] [testenv:genconfig]
envdir = {toxworkdir}/venv
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}/venv
commands = commands =
oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
[testenv:genplacementpolicy] [testenv:genplacementpolicy]
envdir = {toxworkdir}/venv
commands = commands =
oslopolicy-sample-generator --config-file=etc/nova/placement-policy-generator.conf oslopolicy-sample-generator --config-file=etc/nova/placement-policy-generator.conf
@@ -120,6 +128,7 @@ commands =
# section once we rely on coverage 4.3+ # section once we rely on coverage 4.3+
# #
# https://bitbucket.org/ned/coveragepy/issues/519/ # https://bitbucket.org/ned/coveragepy/issues/519/
envdir = {toxworkdir}/venv
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
PYTHON=coverage run --source nova --parallel-mode PYTHON=coverage run --source nova --parallel-mode
@@ -133,6 +142,7 @@ commands =
coverage report coverage report
[testenv:debug] [testenv:debug]
envdir = {toxworkdir}/venv
commands = commands =
{[testenv]commands} {[testenv]commands}
oslo_debug_helper {posargs} oslo_debug_helper {posargs}
@@ -164,6 +174,7 @@ commands =
[testenv:api-guide] [testenv:api-guide]
description = description =
Generate the API guide. Called from CI scripts to test and publish to developer.openstack.org. Generate the API guide. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
commands = commands =
rm -rf api-guide/build rm -rf api-guide/build
@@ -172,6 +183,7 @@ commands =
[testenv:api-ref] [testenv:api-ref]
description = description =
Generate the API ref. Called from CI scripts to test and publish to developer.openstack.org. Generate the API ref. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
commands = commands =
rm -rf api-ref/build rm -rf api-ref/build
@@ -180,6 +192,7 @@ commands =
[testenv:placement-api-ref] [testenv:placement-api-ref]
description = description =
Generate the Placement API ref. Called from CI scripts to test and publish to developer.openstack.org. Generate the Placement API ref. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
commands = commands =
# Check that all placement api routes are in the documentation # Check that all placement api routes are in the documentation
@@ -190,6 +203,7 @@ commands =
[testenv:releasenotes] [testenv:releasenotes]
description = description =
Generate release notes. Generate release notes.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
commands = commands =
rm -rf releasenotes/build rm -rf releasenotes/build
@@ -198,6 +212,7 @@ commands =
[testenv:bandit] [testenv:bandit]
# 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}/venv
commands = bandit -r nova -x tests -n 5 -ll commands = bandit -r nova -x tests -n 5 -ll
[flake8] [flake8]