2012-01-07 19:34:41 -08:00
[tox]
2017-07-26 11:03:13 +02:00
minversion = 2.1
2018-09-03 19:13:38 +01:00
envlist = py{27,35},functional,pep8
2013-08-15 14:36:40 -03:00
skipsdist = True
2012-01-07 19:34:41 -08:00
[testenv]
2018-06-06 16:06:03 -04:00
basepython = python3
2013-08-15 14:36:40 -03:00
usedevelop = True
2018-03-26 15:02:09 +01:00
whitelist_externals =
bash
find
rm
env
2016-01-13 13:46:40 -05:00
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
2018-03-26 15:02:09 +01:00
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
2018-07-24 14:28:07 +01:00
# TODO(stephenfin): Remove psycopg2 when minimum constraints is bumped to 2.8
PYTHONWARNINGS = ignore::UserWarning:psycopg2
2015-10-16 14:30:59 +13:00
deps = -r{toxinidir}/test-requirements.txt
2013-03-06 16:00:37 -05:00
commands =
2016-09-14 10:45:44 +01:00
find . -type f -name "*.pyc" -delete
2018-06-28 15:17:38 +01:00
passenv =
OS_DEBUG GENERATE_HASHES
2017-02-23 17:38:37 +01:00
# there is also secret magic in subunit-trace which lets you run in a fail only
2014-09-24 13:56:49 -04:00
# mode. To do this define the TRACE_FAILONLY environmental variable.
2012-01-07 19:34:41 -08:00
2016-10-17 13:53:10 -07:00
[testenv:py27]
2018-06-06 16:06:03 -04:00
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python2.7
2016-10-17 13:53:10 -07:00
commands =
2018-03-26 15:02:09 +01:00
{[testenv]commands}
stestr run {posargs}
env TEST_OSPROFILER = 1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler'
stestr slowest
2016-10-17 13:53:10 -07:00
[testenv:py35]
2018-06-06 16:06:03 -04:00
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python3.5
2016-10-17 13:53:10 -07:00
commands =
2018-03-26 15:02:09 +01:00
{[testenv]commands}
2018-08-13 15:17:29 +00:00
stestr run {posargs}
2018-03-26 15:02:09 +01:00
env TEST_OSPROFILER = 1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler'
2017-09-13 17:22:19 -04:00
2018-01-16 10:14:46 +00:00
[testenv:py36]
2018-06-06 16:06:03 -04:00
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python3.6
2018-01-16 10:14:46 +00:00
commands =
2018-06-28 15:17:38 +01:00
{[testenv:py35]commands}
2016-10-17 13:53:10 -07:00
2012-01-07 19:34:41 -08:00
[testenv:pep8]
2018-06-28 15:17:38 +01:00
description =
Run style checks.
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2013-05-17 12:54:12 -07:00
commands =
2015-07-24 16:05:49 +01:00
bash tools/flake8wrap.sh {posargs}
2017-03-15 15:57:23 +00:00
# Check that all JSON files don't have \r\n in line.
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
2016-07-13 13:39:47 +02:00
# Check that all included JSON files are valid JSON
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
2012-01-07 19:34:41 -08:00
2017-03-15 13:00:10 -04:00
[testenv:fast8]
2018-06-28 15:17:38 +01:00
description =
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2017-03-15 13:00:10 -04:00
commands =
bash tools/flake8wrap.sh -HEAD
2014-11-06 11:32:34 +01:00
[testenv:functional]
2016-10-12 20:55:40 +00:00
# TODO(melwitt): This can be removed when functional tests are gating with
# python 3.x
2016-10-11 23:59:25 +00:00
basepython = python2.7
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/py27
2017-09-27 20:02:36 +00:00
setenv = {[testenv]setenv}
2014-11-06 11:32:34 +01:00
commands =
2017-09-27 20:02:36 +00:00
{[testenv]commands}
2017-11-21 19:01:11 -05:00
# NOTE(cdent): The group_regex describes how stestr will group tests into the
# same process when running concurently. The following ensures that gabbi tests
# coming from the same YAML file are all in the same process. This is important
# because each YAML file represents an ordered sequence of HTTP requests. Note
# that tests which do not match this regex will not be grouped in any
# special way. See the following for more details.
# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests
# https://gabbi.readthedocs.io/en/latest/#purpose
2018-02-16 17:22:59 -05:00
stestr --test-path = ./nova/tests/functional --group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run {posargs}
2017-09-26 15:27:35 -04:00
stestr slowest
2014-11-06 11:32:34 +01:00
2016-12-08 16:46:57 +08:00
# TODO(gcb) Merge this into [testenv:functional] when functional tests are gating
# with python 3.5
[testenv:functional-py35]
basepython = python3.5
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/py35
2017-09-27 20:02:36 +00:00
setenv = {[testenv]setenv}
2016-12-08 16:46:57 +08:00
commands =
2018-06-28 15:17:38 +01:00
{[testenv:functional]commands}
2016-12-08 16:46:57 +08:00
2018-08-08 11:03:25 +01:00
[testenv:functional-py36]
basepython = python3.6
envdir = {toxworkdir}/py36
setenv = {[testenv]setenv}
commands =
{[testenv:functional]commands}
2015-12-03 17:24:53 -05:00
[testenv:api-samples]
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-03-26 15:02:09 +01:00
setenv =
{[testenv]setenv}
GENERATE_SAMPLES = True
PYTHONHASHSEED = 0
2015-12-03 17:24:53 -05:00
commands =
2018-06-28 15:17:38 +01:00
{[testenv]commands}
2018-02-16 17:22:59 -05:00
stestr --test-path = ./nova/tests/functional/api_sample_tests run {posargs}
2017-09-26 15:27:35 -04:00
stestr slowest
2015-12-03 17:24:53 -05:00
2014-03-19 10:56:49 -07:00
[testenv:genconfig]
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-06-28 15:17:38 +01:00
commands =
oslo-config-generator --config-file = etc/nova/nova-config-generator.conf
2014-03-19 10:56:49 -07:00
2016-06-21 16:53:57 -04:00
[testenv:genpolicy]
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-06-28 15:17:38 +01:00
commands =
oslopolicy-sample-generator --config-file = etc/nova/nova-policy-generator.conf
2016-06-21 16:53:57 -04:00
2017-11-30 18:09:00 -05:00
[testenv:genplacementpolicy]
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-06-28 15:17:38 +01:00
commands =
oslopolicy-sample-generator --config-file = etc/nova/placement-policy-generator.conf
2017-11-30 18:09:00 -05:00
2012-05-25 15:27:03 -04:00
[testenv:cover]
2018-06-28 15:17:38 +01:00
# 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/
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-06-28 15:17:38 +01:00
setenv =
{[testenv]setenv}
PYTHON = coverage run --source nova --parallel-mode
2015-10-19 17:38:17 +11:00
commands =
2018-06-28 15:17:38 +01:00
{[testenv]commands}
2015-10-19 17:38:17 +11:00
coverage erase
2018-02-16 17:22:59 -05:00
stestr run {posargs}
2017-11-21 19:01:11 -05:00
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
2017-02-21 19:51:47 +08:00
coverage report
2015-10-19 17:38:17 +11:00
2016-10-11 21:55:05 +00:00
[testenv:debug]
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2016-10-11 21:55:05 +00:00
commands =
2018-06-28 15:17:38 +01:00
{[testenv]commands}
2016-10-11 21:55:05 +00:00
oslo_debug_helper {posargs}
2012-01-07 19:34:41 -08:00
[testenv:venv]
2018-03-16 10:23:26 +00:00
deps =
2018-07-17 19:44:05 +01:00
-r{toxinidir}/requirements.txt
2018-03-16 10:23:26 +00:00
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
2018-06-28 15:17:38 +01:00
commands =
{posargs}
2013-05-17 12:54:12 -07:00
2014-04-16 16:56:00 -07:00
[testenv:docs]
2018-06-28 15:17:38 +01:00
description =
2018-10-26 17:53:03 +01:00
Build main documentation.
2018-03-16 10:23:26 +00:00
deps = -r{toxinidir}/doc/requirements.txt
2015-01-21 22:25:10 -05:00
commands =
2018-06-28 15:17:38 +01:00
rm -rf doc/build
2016-12-09 12:00:06 +08:00
# Check that all JSON files don't have \r\n in line.
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
2016-07-13 13:39:47 +02:00
# Check that all included JSON files are valid JSON
2015-01-21 22:25:10 -05:00
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
2018-09-20 20:39:19 +09:00
sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html
2018-03-16 10:23:26 +00:00
# Test the redirects. This must run after the main docs build
whereto doc/build/html/.htaccess doc/test/redirect-tests.txt
2015-10-01 17:27:50 -05:00
[testenv:api-guide]
2018-06-28 15:17:38 +01:00
description =
Generate the API guide. Called from CI scripts to test and publish to developer.openstack.org.
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/docs
2018-06-28 15:17:38 +01:00
deps = {[testenv:docs]deps}
2015-10-01 17:27:50 -05:00
commands =
2018-06-28 15:17:38 +01:00
rm -rf api-guide/build
2016-03-13 21:08:49 +01:00
sphinx-build -W -b html -d api-guide/build/doctrees api-guide/source api-guide/build/html
2014-04-16 16:56:00 -07:00
2016-03-29 11:56:21 -04:00
[testenv:api-ref]
2018-06-28 15:17:38 +01:00
description =
Generate the API ref. Called from CI scripts to test and publish to developer.openstack.org.
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/docs
2018-06-28 15:17:38 +01:00
deps = {[testenv:docs]deps}
2016-03-29 11:56:21 -04:00
commands =
2016-04-20 11:20:05 -04:00
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
2016-03-29 11:56:21 -04:00
2016-12-09 21:47:25 +00:00
[testenv:placement-api-ref]
2018-06-28 15:17:38 +01:00
description =
Generate the Placement API ref. Called from CI scripts to test and publish to developer.openstack.org.
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/docs
2018-06-28 15:17:38 +01:00
deps = {[testenv:docs]deps}
2016-12-09 21:47:25 +00:00
commands =
rm -rf placement-api-ref/build
sphinx-build -W -b html -d placement-api-ref/build/doctrees placement-api-ref/source placement-api-ref/build/html
2015-11-05 12:12:28 +01:00
[testenv:releasenotes]
2018-06-28 15:17:38 +01:00
description =
Generate release notes.
2018-06-28 15:16:26 +01:00
envdir = {toxworkdir}/docs
2018-06-28 15:17:38 +01:00
deps = {[testenv:docs]deps}
2018-01-16 17:02:40 +00:00
commands =
rm -rf releasenotes/build
sphinx-build -W -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html
2015-11-05 12:12:28 +01:00
2018-10-26 17:53:03 +01:00
[testenv:all-docs]
description =
Build all documentation including API guides and refs.
envdir = {toxworkdir}/docs
deps = -r{toxinidir}/doc/requirements.txt
commands =
{[testenv:docs]commands}
{[testenv:api-guide]commands}
{[testenv:api-ref]commands}
{[testenv:placement-api-ref]commands}
{[testenv:releasenotes]commands}
2018-06-28 15:17:38 +01:00
[testenv:bandit]
# NOTE(browne): This is required for the integration test job of the bandit
# project. Please do not remove.
2018-08-02 11:31:41 +01:00
envdir = {toxworkdir}/shared
2018-06-28 15:17:38 +01:00
commands = bandit -r nova -x tests -n 5 -ll
2013-05-17 12:54:12 -07:00
[flake8]
2016-08-04 11:31:56 -04:00
# 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.
#
2014-06-09 14:45:26 -07:00
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
2017-02-08 16:41:31 +01:00
enable-extensions = H106,H203,H904
2015-02-09 17:34:09 -05:00
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405
2017-07-12 10:40:37 +01:00
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,tools/xenserver*,releasenotes
2014-10-29 12:22:29 -07:00
# To get a list of functions that are more complex than 25, set max-complexity
# to 25 and run 'tox -epep8'.
2015-03-18 01:58:30 -07:00
# 34 is currently the most complex thing we have
2014-10-16 21:04:08 -07:00
# TODO(jogo): get this number down to 25 or so
2015-03-18 01:58:30 -07:00
max-complexity = 35
2013-05-17 12:54:12 -07:00
[hacking]
local-check-factory = nova.hacking.checks.factory
2014-07-11 21:03:15 -04:00
import_exceptions = nova.i18n
2014-08-14 15:06:00 +10:00
2015-07-10 18:38:51 +00:00
[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
2018-06-28 15:17:38 +01:00
deps = bindep
commands =
bindep test
2018-03-22 16:40:29 -04:00
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
2018-06-28 15:17:38 +01:00
{[testenv]commands}
2018-08-13 15:17:29 +00:00
stestr run {posargs}