3b569321cc
While looking into making py36 available when running tox without '-e' and making py37 more available for both unit testing and functional testing, it became clear that our tox.ini was a bit messy. This change cleans it up to: * Removes all py* jobs and lets tox define those automatically. Their commands come from the base [testenv]. Non-unit tests need to define their commands specifically. * move pep-related tox below both unit and functional * remove some out of date comments * set the default when using tox without -e to unit and functional in 2.7 and 3.6, and pep8 * removes the 'stestr slowest' from the unit and functional test env's. It's not used consistently and the output is far from consistent so it doesn't seem to have any particular value (for this project) This is one of several ways to do this cleanup. This way assumes some knowledge of the fact that tox defines a lot default jobs with default python versions (via factors[1]). Note that the releasenotes job does not currently work and did not work before these changes, a conf.py is missing. [1] https://tox.readthedocs.io/en/latest/config.html#factors-and-factor-conditional-settings Change-Id: I9a877439e13eb753c7f98dc02e41db891ce33690
201 lines
5.8 KiB
INI
201 lines
5.8 KiB
INI
[tox]
|
|
minversion = 2.1
|
|
envlist = py{27,36},functional,functional-py36,pep8
|
|
skipsdist = True
|
|
|
|
[testenv]
|
|
usedevelop = True
|
|
whitelist_externals =
|
|
bash
|
|
find
|
|
rm
|
|
env
|
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
LANGUAGE=en_US
|
|
LC_ALL=en_US.utf-8
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_STDERR_CAPTURE=1
|
|
OS_TEST_TIMEOUT=160
|
|
# TODO(stephenfin): Remove psycopg2 when minimum constraints is bumped to 2.8
|
|
PYTHONWARNINGS = ignore::UserWarning:psycopg2
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
# For a venv that doesn't use stestr commands must be overridden.
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
stestr run {posargs}
|
|
passenv =
|
|
OS_DEBUG GENERATE_HASHES
|
|
# there is also secret magic in subunit-trace which lets you run in a fail only
|
|
# mode. To do this define the TRACE_FAILONLY environmental variable.
|
|
|
|
# The functional environment is both the base env for functional tests and
|
|
# also the python 2.7 version of functional tests. This is a historical
|
|
# artifact.
|
|
[testenv:functional]
|
|
basepython = python2.7
|
|
envdir = {toxworkdir}/py27
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
stestr --test-path=./placement/tests/functional run {posargs}
|
|
|
|
[testenv:functional-py35]
|
|
envdir = {toxworkdir}/py35
|
|
commands =
|
|
{[testenv:functional]commands}
|
|
|
|
[testenv:functional-py36]
|
|
envdir = {toxworkdir}/py36
|
|
commands =
|
|
{[testenv:functional]commands}
|
|
|
|
[testenv:functional-py37]
|
|
envdir = {toxworkdir}/py37
|
|
commands =
|
|
{[testenv:functional]commands}
|
|
|
|
[testenv:pep8]
|
|
basepython = python3
|
|
description =
|
|
Run style checks.
|
|
envdir = {toxworkdir}/shared
|
|
commands =
|
|
bash tools/flake8wrap.sh {posargs}
|
|
|
|
[testenv:fast8]
|
|
basepython = python3
|
|
description =
|
|
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
|
|
envdir = {toxworkdir}/shared
|
|
commands =
|
|
bash tools/flake8wrap.sh -HEAD
|
|
|
|
[testenv:genconfig]
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
commands =
|
|
oslo-config-generator --config-file=etc/placement/config-generator.conf
|
|
|
|
[testenv:genpolicy]
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
commands =
|
|
oslopolicy-sample-generator --config-file=etc/placement/policy-generator.conf
|
|
|
|
[testenv:cover]
|
|
# TODO(stephenfin): Remove the PYTHON hack below in favour of a [coverage]
|
|
# section once we rely on coverage 4.3+
|
|
#
|
|
# https://bitbucket.org/ned/coveragepy/issues/519/
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
setenv =
|
|
{[testenv]setenv}
|
|
PYTHON=coverage run --source placement --parallel-mode
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
coverage erase
|
|
stestr --test-path=./placement/tests run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report
|
|
|
|
[testenv:debug]
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
oslo_debug_helper {posargs}
|
|
|
|
[testenv:venv]
|
|
basepython = python3
|
|
deps =
|
|
-r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/doc/requirements.txt
|
|
commands =
|
|
{posargs}
|
|
|
|
[testenv:docs]
|
|
basepython = python3
|
|
description =
|
|
Build all documentation including API guides and refs.
|
|
deps = -r{toxinidir}/doc/requirements.txt
|
|
commands =
|
|
rm -rf doc/build
|
|
sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html
|
|
{[testenv:api-ref]commands}
|
|
|
|
[testenv:api-ref]
|
|
basepython = python3
|
|
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
|
|
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
|
|
|
[testenv:releasenotes]
|
|
basepython = python3
|
|
description =
|
|
Generate release notes.
|
|
envdir = {toxworkdir}/docs
|
|
deps = {[testenv:docs]deps}
|
|
commands =
|
|
rm -rf releasenotes/build
|
|
sphinx-build -W -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html
|
|
|
|
[testenv:bandit]
|
|
# NOTE(browne): This is required for the integration test job of the bandit
|
|
# project. Please do not remove.
|
|
basepython = python3
|
|
envdir = {toxworkdir}/shared
|
|
commands = bandit -r placement -x tests -n 5 -ll
|
|
|
|
[flake8]
|
|
# E125 is deliberately excluded. See
|
|
# https://github.com/jcrocholl/pep8/issues/126. It's just wrong.
|
|
#
|
|
# Most of the whitespace related rules (E12* and E131) are excluded
|
|
# because while they are often useful guidelines, strict adherence to
|
|
# them ends up causing some really odd code formatting and forced
|
|
# extra line breaks. Updating code to enforce these will be a hard sell.
|
|
#
|
|
# H405 is another one that is good as a guideline, but sometimes
|
|
# multiline doc strings just don't have a natural summary
|
|
# line. Rejecting code for this reason is wrong.
|
|
#
|
|
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
|
|
enable-extensions = H106,H203,H904
|
|
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405
|
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes
|
|
# To get a list of functions that have a complexity of 15 or more, set
|
|
# max-complexity to 15 and run 'tox -epep8'.
|
|
# 14 is currently the most complex thing we have
|
|
max-complexity=15
|
|
|
|
[hacking]
|
|
import_exceptions = placement.i18n
|
|
|
|
[testenv:bindep]
|
|
# Do not install any requirements. We want this to be fast and work even if
|
|
# system dependencies are missing, since it's used to tell you what system
|
|
# dependencies are missing! This also means that bindep must be installed
|
|
# separately, outside of the requirements files, and develop mode disabled
|
|
# explicitly to avoid unnecessarily installing the checked-out repo too (this
|
|
# further relies on "tox.skipsdist = True" above).
|
|
usedevelop = False
|
|
deps = bindep
|
|
commands =
|
|
bindep test
|
|
|
|
[testenv:lower-constraints]
|
|
basepython = python3
|
|
deps =
|
|
-c{toxinidir}/lower-constraints.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-r{toxinidir}/requirements.txt
|