ironic/tox.ini
Jay Faulkner 3dcbc19541 Add tox env for local dev; update documentation
This is a quick and easy way to get Ironic up for testing; updated to be
even quicker and easier if you don't need multiprocess or mysql.

Co-Authored-By: CID <cid@gr-oss.io>
Change-Id: Ibef8a24868fd1f507e69e6d615d6327031d11495
2024-07-01 18:28:12 +00:00

206 lines
6.5 KiB
INI

[tox]
minversion = 4.4.0
envlist = py3,pep8
[testenv]
constrain_package_deps = true
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
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
SQLALCHEMY_WARN_20=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 --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]
usedevelop = False
deps=
hacking~=6.1.0 # Apache-2.0
doc8~=1.1.0 # Apache-2.0
pycodestyle>=2.0.0,<3.0.0 # MIT
flake8-import-order~=0.18.0 # LGPLv3
bashate~=2.1.0 # Apache-2.0
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
allowlist_externals = bash
{toxinidir}/tools/run_bashate.sh
{toxinidir}/tools/check-releasenotes.py
commands =
bash tools/flake8wrap.sh {posargs}
# Run bashate during pep8 runs to ensure violations are caught by
# the check and gate queues.
{toxinidir}/tools/run_bashate.sh {toxinidir}
# Check the *.rst files
doc8 README.rst CONTRIBUTING.rst doc/source api-ref/source --ignore D001
# Check to make sure reno releasenotes created with 'reno new'
{toxinidir}/tools/check-releasenotes.py
[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
[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]
# 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 -b html doc/source doc/build/html
[testenv:pdf-docs]
allowlist_externals = make
deps = {[testenv:docs]deps}
commands =
sphinx-build -W -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 =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
allowlist_externals = bash
commands =
bash -c 'rm -rf api-ref/build'
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:venv]
setenv = PYTHONHASHSEED=0
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[flake8]
# [E129] visually indented line with same indent as next logical line
# [E741] ambiguous variable name
# [W503] Line break before binary operator.
ignore = E129,E741,W503
filename = *.py,app.wsgi
exclude=.*,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
application-import-names = ironic
max-complexity=19
# [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
# [E402] Module level import not at top of file
per-file-ignores =
ironic/cmd/__init__.py:E402
ironic/tests/base.py:E402
[hacking]
import_exceptions = testtools.matchers, ironic.common.i18n
[flake8:local-plugins]
# [N323] Found use of _() without explicit import of _!
extension =
N323 = checks:check_explicit_underscore_import
paths = ./ironic/hacking/
[testenv:bandit]
usedevelop = False
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r ironic -x tests -n5 -ll -c tools/bandit.yml
[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}
[testenv:local-ironic-dev]
constrain_package_deps = true
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE=1
LANGUAGE=en_US
LC_ALL=en_US.UTF-8
PYTHONUNBUFFERED=1
SQLALCHEMY_WARN_20=true
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-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