From 09115c7151d0360490e7bdf70f1e00f69855d3ea Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Tue, 25 Dec 2018 10:21:09 +0900 Subject: [PATCH] tox: Reuse envdirs This massively reduces the amount of time needed to install dependencies and saves a lot of disk space :-) Borrowed from nova change https://review.openstack.org/#/c/534382/ Change-Id: I70bbc41a8f5f7992dc02a5baac632800a4d69acb --- tox.ini | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tox.ini b/tox.ini index 7def53269d..6089824527 100644 --- a/tox.ini +++ b/tox.ini @@ -52,6 +52,7 @@ commands = {posargs} [testenv:pep8] basepython = python3 +# NOTE: Due to doc dependencies, we don't share envdir with "venv". # sphinx (precisely Pygments) needs to be installed to make doc8 work properly deps = {[testenv]deps} @@ -64,6 +65,7 @@ commands = [testenv:cover] basepython = python3 +envdir = {toxworkdir}/venv commands = coverage erase coverage run {toxinidir}/manage.py test horizon --settings=horizon.test.settings {posargs} @@ -74,6 +76,7 @@ commands = [testenv:selenium] basepython = python3 +envdir = {toxworkdir}/venv setenv = {[testenv]setenv} WITH_SELENIUM=1 @@ -82,6 +85,7 @@ commands = {[unit_tests]commands} [testenv:selenium-headless] basepython = python3 +envdir = {toxworkdir}/venv setenv = {[testenv]setenv} SELENIUM_HEADLESS=1 @@ -91,6 +95,7 @@ commands = {[unit_tests]commands} [testenv:selenium-phantomjs] basepython = python3 +envdir = {toxworkdir}/venv setenv = {[testenv]setenv} SELENIUM_PHANTOMJS=1 @@ -99,6 +104,7 @@ setenv = commands = {[unit_tests]commands} [testenv:py27integration] +envdir = {toxworkdir}/py27 # Run integration tests only passenv = AVCONV_INSTALLED setenv = @@ -142,32 +148,28 @@ commands = [testenv:releasenotes] basepython = python3 -# There is no need to install horizon. -usedevelop = False -deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} - -r{toxinidir}/doc/requirements.txt +envdir = {toxworkdir}/docs +deps = {[testenv:docs]deps} commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:manage] basepython = python3 -# we don't need to install test-requirements.txt -# modules in requirements.txt are installed due to usedevelop=True -# so 'deps' can be empty. -deps = +envdir = {toxworkdir}/venv commands = {envpython} {toxinidir}/manage.py {posargs} [testenv:runserver] basepython = python3 +envdir = {toxworkdir}/venv commands = {envpython} {toxinidir}/manage.py runserver {posargs} [testenv:bandit] basepython = python3 +envdir = {toxworkdir}/venv commands = bandit -r horizon openstack_auth openstack_dashboard -n5 -x tests -ll [testenv:bandit-baseline] -envdir = {toxworkdir}/bandit +envdir = {toxworkdir}/venv basepython = python3 [flake8]