placement/tox.ini
Balazs Gibizer 1c8afcd3f1 Make tox.ini tox 4.0.0 compatible
* removed skipsdist=True to make sure placement available in the virtual
  env

* passenv fixed as space separated list is not allowed any more

* improved the doc generation command line to print all the errors
  instead of stopping at the first one

* added functional-py310 for convenience

* removed basepython = python3 as we assume all developer switched to
  python3 in their env already

* removed ignore_basepython_conflict = True as without the basepython
  definition generative targets now work without conflict

* updated the install_command to mimic better what tox uses by default

Depends-On: https://review.opendev.org/c/zuul/zuul-jobs/+/866943
Change-Id: I1de24b7a98f149fce33d4e5eca82460eea72140b
2023-01-09 16:21:22 +01:00

172 lines
4.8 KiB
INI

[tox]
minversion = 3.18.0
envlist = py39,functional-py39,pep8
[testenv]
usedevelop = True
allowlist_externals =
bash
rm
env
install_command = python -I -m pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {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 once we bump our upper-constraint to SQLAlchemy 2.0
SQLALCHEMY_WARN_20=1
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 the base env for functional tests.
[testenv:functional]
commands =
stestr --test-path=./placement/tests/functional run {posargs}
[testenv:functional-py38]
envdir = {toxworkdir}/py38
commands =
{[testenv:functional]commands}
[testenv:functional-py39]
envdir = {toxworkdir}/py39
commands =
{[testenv:functional]commands}
[testenv:functional-py310]
envdir = {toxworkdir}/py310
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 --keep-going -b html -j auto doc/source doc/build/html
# Test the redirects
whereto doc/build/html/.htaccess doc/test/redirect-tests.txt
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
allowlist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:api-ref]
description =
Generate the API ref. Called from CI scripts to test and publish to docs.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.
# W504 skipped since you must choose either W503 or W504 (they conflict)
ignore = H405, W504
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes
# To get a list of functions that have a complexity of 19 or more, set
# max-complexity to 19 and run 'tox -epep8'.
# 19 is currently the most complex thing we have
max-complexity=19
[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
usedevelop = False
skipsdist = True
deps = bindep
commands =
bindep test