fix tox python3 overrides

We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: Id777843680f8e2ece35b61c182135904f1d0158c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2018-09-26 18:43:45 -04:00
parent 4b826abe05
commit 7095c0cd83

209
tox.ini
View File

@@ -1,102 +1,107 @@
[tox] [tox]
minversion = 2.0 minversion = 2.0
skipsdist = True skipsdist = True
envlist = docs,linters,functional envlist = docs,linters,functional
[testenv] [testenv]
usedevelop = True usedevelop = True
install_command = install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
commands = commands =
/usr/bin/find . -type f -name "*.pyc" -delete /usr/bin/find . -type f -name "*.pyc" -delete
passenv = passenv =
COMMON_TESTS_PATH COMMON_TESTS_PATH
HOME HOME
http_proxy http_proxy
HTTP_PROXY HTTP_PROXY
https_proxy https_proxy
HTTPS_PROXY HTTPS_PROXY
no_proxy no_proxy
NO_PROXY NO_PROXY
TESTING_BRANCH TESTING_BRANCH
TESTING_HOME TESTING_HOME
USER USER
whitelist_externals = whitelist_externals =
bash bash
setenv = setenv =
PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1
ROLE_NAME=os_masakari ROLE_NAME=os_masakari
TEST_IDEMPOTENCE=false TEST_IDEMPOTENCE=false
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir} WORKING_DIR={toxinidir}
[testenv:docs] [testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt basepython = python3
commands= deps = -r{toxinidir}/doc/requirements.txt
bash -c "rm -rf doc/build" commands=
doc8 doc bash -c "rm -rf doc/build"
sphinx-build -b html doc/source doc/build/html doc8 doc
sphinx-build -b html doc/source doc/build/html
[doc8]
# Settings for doc8: [doc8]
extensions = .rst # Settings for doc8:
extensions = .rst
[testenv:releasenotes]
deps = -r{toxinidir}/doc/requirements.txt [testenv:releasenotes]
commands = basepython = python3
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# environment used by the -infra templated docs job
[testenv:venv]
commands = # environment used by the -infra templated docs job
{posargs} [testenv:venv]
basepython = python3
commands =
[testenv:pep8] {posargs}
commands =
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[testenv:pep8]
basepython = python3
[flake8] commands =
# Ignores the following rules due to how ansible modules work in general bash -c "{toxinidir}/tests/common/test-pep8.sh"
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
# H303 No wildcard (*) import. [flake8]
ignore=F403,H303 # Ignores the following rules due to how ansible modules work in general
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
[testenv:bashate] # H303 No wildcard (*) import.
commands = ignore=F403,H303
bash -c "{toxinidir}/tests/common/test-bashate.sh"
[testenv:bashate]
[testenv:ansible-syntax] commands =
commands = bash -c "{toxinidir}/tests/common/test-bashate.sh"
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
[testenv:ansible-syntax]
[testenv:ansible-lint] commands =
commands = bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
[testenv:ansible-lint]
[testenv:functional] commands =
commands = bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:functional]
[testenv:linters] commands =
deps = bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
-r{toxinidir}/doc/requirements.txt
commands =
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh" [testenv:linters]
{[testenv:pep8]commands} basepython = python3
{[testenv:bashate]commands} deps =
{[testenv:ansible-lint]commands} -r{toxinidir}/doc/requirements.txt
{[testenv:ansible-syntax]commands} commands =
{[testenv:docs]commands} bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}
{[testenv:docs]commands}