2012-01-07 19:34:41 -08:00
|
|
|
[tox]
|
2019-02-14 09:59:07 -06:00
|
|
|
minversion = 3.1.1
|
2018-10-18 21:36:00 +01:00
|
|
|
envlist = py{27,36},functional,functional-py36,pep8
|
2013-08-15 14:36:40 -03:00
|
|
|
skipsdist = True
|
2019-02-14 09:59:07 -06:00
|
|
|
# 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
|
2012-01-07 19:34:41 -08:00
|
|
|
|
|
|
|
[testenv]
|
2019-02-14 09:59:07 -06:00
|
|
|
basepython = python3
|
2013-08-15 14:36:40 -03:00
|
|
|
usedevelop = True
|
2018-03-26 15:02:09 +01:00
|
|
|
whitelist_externals =
|
|
|
|
bash
|
|
|
|
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
|
2019-02-14 09:54:44 -06:00
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
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
|
2018-10-18 21:36:00 +01:00
|
|
|
# For a venv that doesn't use stestr commands must be overridden.
|
2013-03-06 16:00:37 -05:00
|
|
|
commands =
|
2018-10-18 21:36:00 +01:00
|
|
|
stestr run {posargs}
|
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
|
|
|
|
2018-10-18 21:36:00 +01:00
|
|
|
# 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]
|
2018-06-06 16:06:03 -04:00
|
|
|
basepython = python2.7
|
2018-10-18 21:36:00 +01:00
|
|
|
envdir = {toxworkdir}/py27
|
2016-10-17 13:53:10 -07:00
|
|
|
commands =
|
2018-10-18 21:36:00 +01:00
|
|
|
stestr --test-path=./placement/tests/functional run {posargs}
|
2016-10-17 13:53:10 -07:00
|
|
|
|
2018-10-18 21:36:00 +01:00
|
|
|
[testenv:functional-py35]
|
|
|
|
envdir = {toxworkdir}/py35
|
2016-10-17 13:53:10 -07:00
|
|
|
commands =
|
2018-10-18 21:36:00 +01:00
|
|
|
{[testenv:functional]commands}
|
2017-09-13 17:22:19 -04:00
|
|
|
|
2018-10-18 21:36:00 +01:00
|
|
|
[testenv:functional-py36]
|
|
|
|
envdir = {toxworkdir}/py36
|
2018-01-16 10:14:46 +00:00
|
|
|
commands =
|
2018-10-18 21:36:00 +01:00
|
|
|
{[testenv:functional]commands}
|
|
|
|
|
|
|
|
[testenv:functional-py37]
|
|
|
|
envdir = {toxworkdir}/py37
|
|
|
|
commands =
|
|
|
|
{[testenv:functional]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}
|
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-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 =
|
2018-09-13 10:43:21 -06:00
|
|
|
oslo-config-generator --config-file=etc/placement/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 =
|
2018-09-06 18:44:17 +00:00
|
|
|
oslopolicy-sample-generator --config-file=etc/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}
|
2018-09-03 12:12:23 +01:00
|
|
|
PYTHON=coverage run --source placement --parallel-mode
|
2015-10-19 17:38:17 +11:00
|
|
|
commands =
|
|
|
|
coverage erase
|
2018-09-09 07:36:09 -06:00
|
|
|
stestr --test-path=./placement/tests 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 =
|
|
|
|
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 =
|
|
|
|
Build all documentation including API guides and refs.
|
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
|
2018-09-21 09:36:57 +09:00
|
|
|
sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html
|
2018-06-28 15:17:38 +01:00
|
|
|
{[testenv:api-ref]commands}
|
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
|
|
|
|
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-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-09-03 12:12:23 +01:00
|
|
|
commands = bandit -r placement -x tests -n 5 -ll
|
2018-06-28 15:17:38 +01:00
|
|
|
|
2013-05-17 12:54:12 -07:00
|
|
|
[flake8]
|
2017-02-08 16:41:31 +01:00
|
|
|
enable-extensions = H106,H203,H904
|
2019-03-01 17:12:20 -06:00
|
|
|
# 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
|
2018-09-03 12:12:23 +01:00
|
|
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes
|
2018-09-10 18:42:32 -06:00
|
|
|
# To get a list of functions that have a complexity of 15 or more, set
|
|
|
|
# max-complexity to 15 and run 'tox -epep8'.
|
2018-09-14 15:42:46 -06:00
|
|
|
# 14 is currently the most complex thing we have
|
|
|
|
max-complexity=15
|
2013-05-17 12:54:12 -07:00
|
|
|
|
|
|
|
[hacking]
|
2018-09-03 12:12:23 +01:00
|
|
|
import_exceptions = placement.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]
|
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}
|
2018-03-22 16:40:29 -04:00
|
|
|
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}
|