Modernize tox configuration

The changes modernize the tox configuration by:
- Bumping minimum tox version from 3.1.1 to 3.18.0
- Replacing deprecated whitelist_externals with allowlist_externals
- Enabling usedevelop = True for development mode
- Adding proper environment variable pass-through with documentation
- Updating the constraints file URL to the newer releases.openstack.org location
- Improving the overall structure and formatting
- Use 2 space indentation

Change-Id: Iaee4242749d8549f947ee5c1876b663128b0d515
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
Co-Authored-By: Sean Mooney <work@seanmooney.info>
This commit is contained in:
Chandan Kumar (raukadah)
2026-04-02 12:56:38 +05:30
parent 7a662b9a50
commit fba9bcc3ae

56
tox.ini
View File

@@ -1,22 +1,33 @@
[tox]
minversion = 3.1.1
minversion = 3.18.0
envlist = py3,pep8
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = False
whitelist_externals = rm
install_command = pip install -c{env:TOX_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
usedevelop = True
allowlist_externals = rm
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
PYTHONDONTWRITEBYTECODE=1
passenv =
# LOCALE_ARCHIVE is needed when not using python from the system package
# manager (e.g. when installed with nix) to ensure the locale-archive is
# available to the tests. specifically this is needed by sphinx to build
# the docs.
LOCALE_ARCHIVE
OS_DEBUG
# NOTE(sean-k-mooney) optimization is enabled by default and when enabled
# asserts are complied out. Disable optimization to allow asserts in
# cyborgclient to fire in unit and functional tests. This can be useful
# for debugging issue with fixtures and mocks.
PYTHONOPTIMIZE
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}
[testenv:pep8]
@@ -27,17 +38,18 @@ commands = {posargs}
[testenv:cover]
setenv =
VIRTUAL_ENV={envdir}
PYTHON=coverage run --source cyborgclient --parallel-mode
VIRTUAL_ENV={envdir}
PYTHON=coverage run --source cyborgclient --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:releasenotes]