tox: Slight tweaks

- Use 'ignore_basepython_conflict' and set 'basepython' globally,
  avoiding the need to do it in each environment
- Set 'commands' in the top-level 'testenv' and just reference this
  where needed
- Remove unneeded 'setenv'

Change-Id: Ib2ac6279abf5cf3fa39cb1b72622e41c502429b5
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2019-08-26 14:10:08 +01:00 committed by Akihiro Motoki
parent c82c955160
commit 98d20a65d8

57
tox.ini
View File

@ -1,10 +1,14 @@
[tox] [tox]
envlist = pep8,py27,py36,py37,py3-dj111,releasenotes,npm minversion = 3.1
minversion = 2.5.0 envlist = pep8,py27,py36,py37,py3-dj{111,21,22},releasenotes,npm
skipsdist = True skipsdist = True
# Automatic envs (pyXX) will only use the python version appropriate to that
# env and ignore basepython inherited from [testenv] if we set
# ignore_basepython_conflict.
ignore_basepython_conflict = True
[testenv] [testenv]
install_command = pip install {opts} {packages} basepython = python3
usedevelop = True usedevelop = True
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
@ -15,52 +19,29 @@ deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
commands = {[unit_tests]commands}
[unit_tests]
commands = commands =
dj111: pip install django>=1.11,<2.0
dj21: pip install django>=2.1,<2.2
dj22: pip install django>=2.2,<2.3
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs} bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs}
[testenv:py3-dj21]
basepython = python3
commands =
pip install django>=2.1<2.2
{[unit_tests]commands}
[testenv:py3-dj22]
basepython = python3
commands =
pip install django>=2.2<2.3
{[unit_tests]commands}
[testenv:py3-dj111]
basepython = python3
commands =
pip install django>=1.11,<2
{[unit_tests]commands}
[testenv:lower-constraints] [testenv:lower-constraints]
basepython = python3
deps = deps =
-c{toxinidir}/lower-constraints.txt -c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
[testenv:venv] [testenv:venv]
basepython = python3
commands = {posargs} commands = {posargs}
[testenv:pep8] [testenv:pep8]
basepython = python3
# NOTE: Due to doc dependencies, we don't share envdir with "venv". # NOTE: Due to doc dependencies, we don't share envdir with "venv".
# sphinx (precisely Pygments) needs to be installed to make doc8 work properly # sphinx (precisely Pygments) needs to be installed to make doc8 work properly
deps = deps =
{[testenv]deps} {[testenv]deps}
-r{toxinidir}/doc/requirements.txt -r{toxinidir}/doc/requirements.txt
setenv = setenv =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
commands = commands =
flake8 {posargs} flake8 {posargs}
@ -70,7 +51,6 @@ commands =
pylint -j 4 --verbose --rcfile=.pylintrc -f colorized openstack_dashboard openstack_auth horizon pylint -j 4 --verbose --rcfile=.pylintrc -f colorized openstack_dashboard openstack_auth horizon
[testenv:cover] [testenv:cover]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
commands = commands =
coverage erase coverage erase
@ -81,36 +61,29 @@ commands =
coverage html coverage html
[testenv:selenium] [testenv:selenium]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
WITH_SELENIUM=1 WITH_SELENIUM=1
SKIP_UNITTESTS=1 SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-headless] [testenv:selenium-headless]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
SELENIUM_HEADLESS=1 SELENIUM_HEADLESS=1
WITH_SELENIUM=1 WITH_SELENIUM=1
SKIP_UNITTESTS=1 SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-phantomjs] [testenv:selenium-phantomjs]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
SELENIUM_PHANTOMJS=1 SELENIUM_PHANTOMJS=1
WITH_SELENIUM=1 WITH_SELENIUM=1
SKIP_UNITTESTS=1 SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:integration] [testenv:integration]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
# Run integration tests only # Run integration tests only
passenv = AVCONV_INSTALLED passenv = AVCONV_INSTALLED
@ -121,7 +94,6 @@ setenv =
commands = {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --verbosity 2 --tag integration {posargs} commands = {envpython} {toxinidir}/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings --verbosity 2 --tag integration {posargs}
[testenv:npm] [testenv:npm]
basepython = python3
passenv = passenv =
HOME HOME
DISPLAY DISPLAY
@ -131,7 +103,6 @@ commands =
npm run {posargs:test} npm run {posargs:test}
[testenv:tests_system_packages] [testenv:tests_system_packages]
basepython = python3
# Provide an environment for system packagers that dont want anything from pip # Provide an environment for system packagers that dont want anything from pip
# Any extra deps needed for this env can be passed by setting TOX_EXTRA_DEPS # Any extra deps needed for this env can be passed by setting TOX_EXTRA_DEPS
sitepackages = True sitepackages = True
@ -140,10 +111,9 @@ passenv = TOX_EXTRA_DEPS http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy
deps = deps =
commands = commands =
pip install -U {env:TOX_EXTRA_DEPS:} pip install -U {env:TOX_EXTRA_DEPS:}
{[unit_tests]commands} {[testenv]commands}
[testenv:docs] [testenv:docs]
basepython = python3
# We need to install horizon dependecies to build module references # We need to install horizon dependecies to build module references
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
@ -153,19 +123,16 @@ commands =
sphinx-build -W -b html doc/source doc/build/html sphinx-build -W -b html doc/source doc/build/html
[testenv:releasenotes] [testenv:releasenotes]
basepython = python3
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
commands = commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:manage] [testenv:manage]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
commands = {envpython} {toxinidir}/manage.py {posargs} commands = {envpython} {toxinidir}/manage.py {posargs}
[testenv:runserver] [testenv:runserver]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
commands = commands =
{envpython} {toxinidir}/manage.py compilemessages {envpython} {toxinidir}/manage.py compilemessages
@ -173,13 +140,11 @@ commands =
{envpython} {toxinidir}/manage.py runserver {posargs} {envpython} {toxinidir}/manage.py runserver {posargs}
[testenv:bandit] [testenv:bandit]
basepython = python3
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
commands = bandit -r horizon openstack_auth openstack_dashboard -n5 -x tests -ll commands = bandit -r horizon openstack_auth openstack_dashboard -n5 -x tests -ll
[testenv:bandit-baseline] [testenv:bandit-baseline]
envdir = {toxworkdir}/venv envdir = {toxworkdir}/venv
basepython = python3
commands = bandit-baseline -r horizon openstack_auth openstack_dashboard -n5 -x tests -ii -ll commands = bandit-baseline -r horizon openstack_auth openstack_dashboard -n5 -x tests -ii -ll
[flake8] [flake8]