Files
ironic/tox.ini
T
Jay Faulkner 5b683ec7a0 Fix docs build breakage caused by new o.vo
Before this change, type annotations are rendered by sphinx autodoc and
due to recent oslo.versionedobjects changes, expand out into multiple
conflicting types that causes a warning. Instead, tell sphinx not to
render type hints in autodoc.

Assisted-by: Claude-code (opus 4.7)
Change-Id: Ia158cf6c58faaa4db01d822706e9ff7500fdf101
Signed-off-by: Jay Faulkner <jay@jvf.cc>
2026-05-13 13:56:02 -07:00

190 lines
5.6 KiB
INI

[tox]
minversion = 4.28.0
envlist = py3,pep8
[testenv]
constrain_package_deps = true
usedevelop = True
setenv = PYTHONDONTWRITEBYTECODE=1
LANGUAGE=en_US
LC_ALL=en_US.UTF-8
BASE_TEST_TIMEOUT={env:BASE_TEST_TIMEOUT:60}
MIGRATIONS_TIMEOUT={env:MIGRATIONS_TIMEOUT:180}
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
PYTHONUNBUFFERED=1
constraints=
{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run --slowest --parallel-class --exclude-regex TestMigrationsMySQL {posargs}
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
[testenv:unit-with-driver-libs]
deps = {[testenv]deps}
-r{toxinidir}/driver-requirements.txt
[testenv:genstates]
allowlist_externals = {toxinidir}/tools/states_to_dot.py
deps = {[testenv]deps}
pydot
commands = {toxinidir}/tools/states_to_dot.py -f {toxinidir}/doc/source/images/states.svg --format svg
[testenv:pep8]
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure {posargs}
[testenv:bandit]
deps = {[testenv:pep8]deps}
commands = pre-commit run --all-files --show-diff-on-failure bandit
[testenv:codespell]
description =
Run codespell to check spelling
deps = {[testenv:pep8]deps}
commands = pre-commit run --all-files --show-diff-on-failure codespell
[testenv:cover]
setenv = {[testenv]setenv}
PYTHON=coverage run --source ironic --parallel-mode
commands =
coverage erase
stestr run --parallel-class {posargs}
coverage combine
coverage report
coverage html -d ./cover
[testenv:genconfig]
sitepackages = False
commands =
oslo-config-generator --config-file=tools/config/ironic-config-generator.conf
oslo-config-generator --config-file=tools/config/ironic-networking-config-generator.conf
[testenv:genpolicy]
sitepackages = False
commands =
oslopolicy-sample-generator --config-file=tools/policy/ironic-policy-generator.conf
[testenv:mysql-migrations]
sitepackages = False
commands =
stestr run --slowest --parallel-class TestMigrationsMySQL {posargs}
[testenv:debug]
commands = oslo_debug_helper -t ironic/tests/unit {posargs}
[testenv:docs]
allowlist_externals =
bash
dot
# NOTE(dtantsur): documentation building process requires importing ironic
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
bash -c 'rm -rf doc/source/contributor/api'
sphinx-build -W -j auto -E -b html doc/source doc/build/html
[testenv:pdf-docs]
allowlist_externals =
make
dot
deps = {[testenv:docs]deps}
commands =
sphinx-build -E -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:api-ref]
# NOTE(Mahnoor): documentation building process requires importing ironic API modules
usedevelop = False
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
allowlist_externals = bash
commands =
bash -c 'rm -rf api-ref/build'
sphinx-build -E -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:releasenotes]
usedevelop = False
deps =
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:venv]
setenv = PYTHONHASHSEED=0
# NOTE(JayF) The generic venv target exists to allow people to run arbitrary
# things, e.g. `reno`. For this reason, allow all externals in this
# environment.
allowlist_externals = *
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:local-ironic-dev]
constrain_package_deps = true
setenv = PYTHONDONTWRITEBYTECODE=1
LANGUAGE=en_US
LC_ALL=en_US.UTF-8
PYTHONUNBUFFERED=1
SQLALCHEMY_WARN_20=true
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/driver-requirements.txt
python-ironicclient
python-openstackclient
allowlist_externals = bash
commands =
bash -c 'ironic-dbsync --config-file={toxinidir}/tools/ironic.conf.localdev create_schema || echo "===== DB already exists; continuing ====="'
ironic --config-file={toxinidir}/tools/ironic.conf.localdev {posargs}
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
[flake8]
# [W503] Line break before binary operator.
# Ignore all E and F rules - handled by ruff instead
ignore = E,F,W503
# re-enable some pycodestyle checks due to
# https://github.com/astral-sh/ruff/issues/2402
# this can be dropped if https://github.com/astral-sh/ruff/pull/13585
# is merged in a release of ruff we use
extend-select = E122,E124,E125,E127,E128,E131,E704
filename = *.py,app.wsgi
exclude=.*,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
application-import-names = ironic
max-complexity=20
# [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
[flake8:local-plugins]
# [N323] Found use of _() without explicit import of _!
# [I319] eventlet import not allowed
extension =
N323 = checks:check_explicit_underscore_import
I319 = checks:no_eventlet_imports
paths = ./ironic/hacking/
[hacking]
import_exceptions =
ironic.common.i18n