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

61
tox.ini
View File

@ -1,10 +1,14 @@
[tox]
envlist = pep8,py27,py36,py37,py3-dj111,releasenotes,npm
minversion = 2.5.0
minversion = 3.1
envlist = pep8,py27,py36,py37,py3-dj{111,21,22},releasenotes,npm
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]
install_command = pip install {opts} {packages}
basepython = python3
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
@ -15,52 +19,29 @@ deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands = {[unit_tests]commands}
[unit_tests]
commands =
find . -type f -name "*.pyc" -delete
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}
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
bash {toxinidir}/tools/unit_tests.sh {envpython} {toxinidir} {posargs}
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
[testenv:venv]
basepython = python3
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}
-r{toxinidir}/doc/requirements.txt
setenv =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=openstack_dashboard.test.settings
commands =
flake8 {posargs}
@ -70,7 +51,6 @@ commands =
pylint -j 4 --verbose --rcfile=.pylintrc -f colorized openstack_dashboard openstack_auth horizon
[testenv:cover]
basepython = python3
envdir = {toxworkdir}/venv
commands =
coverage erase
@ -81,36 +61,29 @@ commands =
coverage html
[testenv:selenium]
basepython = python3
envdir = {toxworkdir}/venv
setenv =
{[testenv]setenv}
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-headless]
basepython = python3
envdir = {toxworkdir}/venv
setenv =
{[testenv]setenv}
SELENIUM_HEADLESS=1
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:selenium-phantomjs]
basepython = python3
envdir = {toxworkdir}/venv
setenv =
{[testenv]setenv}
SELENIUM_PHANTOMJS=1
WITH_SELENIUM=1
SKIP_UNITTESTS=1
commands = {[unit_tests]commands}
[testenv:integration]
basepython = python3
envdir = {toxworkdir}/venv
# Run integration tests only
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}
[testenv:npm]
basepython = python3
passenv =
HOME
DISPLAY
@ -131,7 +103,6 @@ commands =
npm run {posargs:test}
[testenv:tests_system_packages]
basepython = python3
# 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
sitepackages = True
@ -140,10 +111,9 @@ passenv = TOX_EXTRA_DEPS http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy
deps =
commands =
pip install -U {env:TOX_EXTRA_DEPS:}
{[unit_tests]commands}
{[testenv]commands}
[testenv:docs]
basepython = python3
# We need to install horizon dependecies to build module references
deps =
-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
[testenv:releasenotes]
basepython = python3
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
envdir = {toxworkdir}/venv
commands = {envpython} {toxinidir}/manage.py {posargs}
[testenv:runserver]
basepython = python3
envdir = {toxworkdir}/venv
commands =
{envpython} {toxinidir}/manage.py compilemessages
@ -173,13 +140,11 @@ 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}/venv
basepython = python3
commands = bandit-baseline -r horizon openstack_auth openstack_dashboard -n5 -x tests -ii -ll
[flake8]