ironic-inspector/tox.ini
Riccardo Pittau bd08bf4f85 Force constraints when installing a package during tox test
The tox deps option grants installation of single dependencies and
requirements, optionally pinned using constraints, before installing
a package, therefore not granting installation of the correct
constraint during the package installation.
To fix that tox 4.4.0 has introduced the constrain_package_deps
option [1]

[1] https://tox.wiki/en/4.12.1/faq.html#using-constraint-files

Change-Id: Ied659411bffb3f37e67523bc50a6a03b19cceef6
2024-02-12 14:57:43 +01:00

140 lines
4.4 KiB
INI

[tox]
minversion = 4.4.0
envlist = py3,pep8
[testenv]
constrain_package_deps = true
usedevelop = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run {posargs}
setenv =
VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE=1
PYTHONUNBUFFERED=1
SQLALCHEMY_WARN_20=true
TZ=UTC
TESTS_DIR=./ironic_inspector/test/unit/
passenv = http_proxy,HTTP_PROXY,https_proxy,HTTPS_PROXY,no_proxy,NO_PROXY
[testenv:venv]
commands = {posargs}
[testenv:api-ref]
usedevelop = False
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
allowlist_externals = bash
commands =
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:releasenotes]
usedevelop = False
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --branch --omit='*test*' --source ironic_inspector --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage report -m --omit='*test*'
coverage html -d ./cover --omit='*test*'
[testenv:pep8]
usedevelop = False
deps =
flake8-import-order>=0.17.1 # LGPLv3
hacking~=6.1.0 # Apache-2.0
pycodestyle>=2.0.0,<3.0.0 # MIT
doc8>=0.8.1 # Apache-2.0
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
commands =
flake8 ironic_inspector
doc8 -e .rst -e .inc README.rst CONTRIBUTING.rst doc/source api-ref/source
[testenv:functional]
commands =
python3 -m ironic_inspector.test.functional {posargs}
[testenv:genconfig]
envdir = {toxworkdir}/venv
commands = oslo-config-generator --config-file {toxinidir}/tools/config-generator.conf
[testenv:genpolicy]
sitepackages = False
envdir = {toxworkdir}/venv
commands = oslopolicy-sample-generator --config-file {toxinidir}/tools/policy-generator.conf
[testenv:genstates]
deps = {[testenv]deps}
commands = {toxinidir}/tools/states_to_dot.py -f {toxinidir}/doc/source/images/states.svg --format svg
[flake8]
max-complexity=15
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H204] Use assert(Not)Equal to check for equality.
# [H205] Use assert(Greater|Less)(Equal) for comparison.
# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
# [H904] Delay string interpolations at logging calls.
enable-extensions=H106,H203,H204,H205,H210,H904
import-order-style = pep8
application-import-names = ironic_inspector
[hacking]
import_exceptions = ironic_inspector.common.i18n
[testenv:docs]
setenv = PYTHONHASHSEED=0
sitepackages = False
# NOTE(dtantsur): documentation building process requires importing ironic
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
allowlist_externals = make
deps = {[testenv:docs]deps}
commands =
sphinx-build -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:bandit]
usedevelop = False
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
commands = bandit -r ironic_inspector -x test -n 5 -ll -c tools/bandit.yml
# This environment can be used to quickly validate that all needed system
# packages required to successfully execute test targets are installed
[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.
deps = bindep
commands = bindep test
[testenv:codespell]
description =
Run codespell to check spelling
deps = codespell
# note(JayF): {posargs} lets us run `tox -ecodespell -- -w` to get codespell
# to correct spelling issues in our code it's aware of.
commands =
codespell {posargs}