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
tox.ini
View File

@ -54,6 +54,7 @@ commands =
description =
Run style checks.
deps = {[testenv]deps}
envdir = {toxworkdir}/venv
commands =
bash tools/flake8wrap.sh {posargs}
# Check that all JSON files don't have \r\n in line.
@ -64,6 +65,7 @@ commands =
[testenv:fast8]
description =
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
envdir = {toxworkdir}/venv
commands =
bash tools/flake8wrap.sh -HEAD
@ -71,6 +73,7 @@ commands =
# TODO(melwitt): This can be removed when functional tests are gating with
# python 3.x
basepython = python2.7
envdir = {toxworkdir}/py27
setenv = {[testenv]setenv}
commands =
{[testenv]commands}
@ -89,11 +92,13 @@ commands =
# with python 3.5
[testenv:functional-py35]
basepython = python3.5
envdir = {toxworkdir}/py35
setenv = {[testenv]setenv}
commands =
{[testenv:functional]commands}
[testenv:api-samples]
envdir = {toxworkdir}/venv
setenv =
{[testenv]setenv}
GENERATE_SAMPLES=True
@ -104,14 +109,17 @@ commands =
stestr slowest
[testenv:genconfig]
envdir = {toxworkdir}/venv
commands =
oslo-config-generator --config-file=etc/nova/nova-config-generator.conf
[testenv:genpolicy]
envdir = {toxworkdir}/venv
commands =
oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
[testenv:genplacementpolicy]
envdir = {toxworkdir}/venv
commands =
oslopolicy-sample-generator --config-file=etc/nova/placement-policy-generator.conf
@ -120,6 +128,7 @@ commands =
# section once we rely on coverage 4.3+
#
# https://bitbucket.org/ned/coveragepy/issues/519/
envdir = {toxworkdir}/venv
setenv =
{[testenv]setenv}
PYTHON=coverage run --source nova --parallel-mode
@ -133,6 +142,7 @@ commands =
coverage report
[testenv:debug]
envdir = {toxworkdir}/venv
commands =
{[testenv]commands}
oslo_debug_helper {posargs}
@ -164,6 +174,7 @@ commands =
[testenv:api-guide]
description =
Generate the API guide. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
rm -rf api-guide/build
@ -172,6 +183,7 @@ commands =
[testenv:api-ref]
description =
Generate the API ref. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
rm -rf api-ref/build
@ -180,6 +192,7 @@ commands =
[testenv:placement-api-ref]
description =
Generate the Placement API ref. Called from CI scripts to test and publish to developer.openstack.org.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
# Check that all placement api routes are in the documentation
@ -190,6 +203,7 @@ commands =
[testenv:releasenotes]
description =
Generate release notes.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
rm -rf releasenotes/build
@ -198,6 +212,7 @@ commands =
[testenv:bandit]
# NOTE(browne): This is required for the integration test job of the bandit
# project. Please do not remove.
envdir = {toxworkdir}/venv
commands = bandit -r nova -x tests -n 5 -ll
[flake8]