placement/tox.ini
2024-10-01 21:59:42 +00:00

150 lines
4.3 KiB
INI

[tox]
minversion = 4.6.0
envlist = py3,functional,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.
[testenv:functional{,-py39,-py310,-py311,-py312}]
commands =
stestr --test-path=./placement/tests/functional run {posargs}
[testenv:pep8]
description =
Run style checks.
skip_install = true
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:fast8]
description =
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
commands =
bash tools/flake8wrap.sh -HEAD
[testenv:genconfig]
commands =
oslo-config-generator --config-file=etc/placement/config-generator.conf
[testenv:genpolicy]
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/
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]
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.
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.
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.
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