189 lines
5.6 KiB
INI
Raw Normal View History

[tox]
minversion = 3.1.1
envlist = py{27,36},functional,functional-py36,pep8
skipsdist = True
# Automatic envs (pyXX) will use the python version appropriate to that
# env and ignore basepython inherited from [testenv]. That's what we
# want, and we don't need to be warned about it.
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
whitelist_externals =
bash
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
PYTHONDONTWRITEBYTECODE=1
# 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 =
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 =
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]
description =
Run style checks.
envdir = {toxworkdir}/shared
commands =
bash tools/flake8wrap.sh {posargs}
[testenv:fast8]
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]
envdir = {toxworkdir}/shared
commands =
oslo-config-generator --config-file=etc/placement/config-generator.conf
[testenv:genpolicy]
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/
envdir = {toxworkdir}/shared
setenv =
{[testenv]setenv}
PYTHON=coverage run --source placement --parallel-mode
commands =
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]
envdir = {toxworkdir}/shared
commands =
oslo_debug_helper {posargs}
[testenv:venv]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
{posargs}
[testenv:docs]
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]
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]
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.
envdir = {toxworkdir}/shared
commands = bandit -r placement -x tests -n 5 -ll
[flake8]
enable-extensions = H106,H203,H904
# H405 is a good guideline, but sometimes multiline doc strings just don't have
# a natural summary line. Rejecting code for this reason is wrong.
ignore = 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]
Correct lower-constraints.txt and the related tox job While exploring removing unused packages from lower-constraints.txt it became clear that the lower-constraints job was not working as expected: Because our tox config has usedevelop=True 'setup.py develop' is called to install the placement package after the install command is called. This means that the lower-constraints are clobbered. I had mistakenly assumed that turning off 'usedevelop', which causes 'setup.py install' would not make any difference, because it usually installs dependencies too. It turns out however, that when using pbr and within a git working dir, it does not. That took some time to figure out. Oh well. This change makes it so that we create the tox environment using usedevelop=False and with our own install_command, to avoid upper constraints conflicting with lower constraints. This flagged up a few changes, the main one being that we did not have a new enough version of keystonemiddleware in order to require use of www_authenticate_uri. requirements.txt is updated for this as well. And PasteDeploy needed to be updated to work with Python 3's notion of namespace packages. psycopg2 need a newer version to work with Postgresql 10. oslotest needs to be raised to 3.4.0 because the tests in cmd.test_manage use features to control what is capture by the Output fixture from oslotest. Note that the lower-constraints job found this problem and also demonstrates why we must run the lower-constraints job without upper-constraints being involved. upper-constraints will "win" and we don't want that. The point of the job is find packages where lower-constraints are wrong, so it must "win". The end result here is a lower-constraints.txt file that starts from the lower-constraints.txt defined by nova, and then is adapted to update the versions of packages that were not up to date, remove those packages which are no longer present, and add some that are now required. Change-Id: Id66a28f7ace6fc2adf0e1201d9de5f901234d870
2018-10-31 15:44:16 +00:00
# When using pbr and in a git repo, 'setup.py install' does not install
# packages. 'setup.py develop', used when usedevelop is True, does.
usedevelop = False
# Use our own install_command to turn off upper constraints, which conflicts
# with lower constraints.
install_command = pip install {opts} {packages}
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
Correct lower-constraints.txt and the related tox job While exploring removing unused packages from lower-constraints.txt it became clear that the lower-constraints job was not working as expected: Because our tox config has usedevelop=True 'setup.py develop' is called to install the placement package after the install command is called. This means that the lower-constraints are clobbered. I had mistakenly assumed that turning off 'usedevelop', which causes 'setup.py install' would not make any difference, because it usually installs dependencies too. It turns out however, that when using pbr and within a git working dir, it does not. That took some time to figure out. Oh well. This change makes it so that we create the tox environment using usedevelop=False and with our own install_command, to avoid upper constraints conflicting with lower constraints. This flagged up a few changes, the main one being that we did not have a new enough version of keystonemiddleware in order to require use of www_authenticate_uri. requirements.txt is updated for this as well. And PasteDeploy needed to be updated to work with Python 3's notion of namespace packages. psycopg2 need a newer version to work with Postgresql 10. oslotest needs to be raised to 3.4.0 because the tests in cmd.test_manage use features to control what is capture by the Output fixture from oslotest. Note that the lower-constraints job found this problem and also demonstrates why we must run the lower-constraints job without upper-constraints being involved. upper-constraints will "win" and we don't want that. The point of the job is find packages where lower-constraints are wrong, so it must "win". The end result here is a lower-constraints.txt file that starts from the lower-constraints.txt defined by nova, and then is adapted to update the versions of packages that were not up to date, remove those packages which are no longer present, and add some that are now required. Change-Id: Id66a28f7ace6fc2adf0e1201d9de5f901234d870
2018-10-31 15:44:16 +00:00
# Test with both functional and unit tests.
commands =
{[testenv]commands}
stestr --test-path=./placement/tests run {posargs}