mistral/tox.ini
Arnaud M 800c3dbf93 Add fast8 tox env
This was taken from the nova project, fast8 will allow running flake8
tests on a subset of changes (only HEAD) which is quicker.

Change-Id: I9069edad75befcd4995a1c23924e2856da56c216
Signed-off-by: Arnaud M <arnaud.morin@gmail.com>
2024-10-06 12:29:06 +02:00

171 lines
4.1 KiB
INI

[tox]
envlist = py3,pep8
minversion = 3.18.0
# This is the default env for tests, which is going to be used for all py3*
[testenv]
description =
Run unit tests.
usedevelop = True
install_command = python -I -m pip install -c{env:TOX_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
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
allowlist_externals =
bash
commands =
bash {toxinidir}/tools/prepare_db.sh sqlite
stestr run --color {posargs}
stestr slowest
[testenv:pep8]
description =
Run pep8 tests.
commands =
doc8 doc/source
flake8 {posargs} . {toxinidir}/tools/sync_db.py
[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
# Deprecated
[testenv:unit-postgresql]
description =
Run unit tests with postgresql backend.
commands =
bash {toxinidir}/tools/prepare_db.sh postgresql
stestr run --color {posargs}
stestr slowest
# Deprecated
[testenv:unit-mysql]
description =
Run unit tests with mysql backend.
commands =
bash {toxinidir}/tools/prepare_db.sh mysql
stestr run --color {posargs}
stestr slowest
[testenv:cover]
description =
Run coverage tests.
setenv =
{[testenv]setenv}
PYTHON=coverage run --source mistral --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:genconfig]
description =
Build mistral.conf sample file.
commands =
oslo-config-generator \
--config-file=tools/config/config-generator.mistral.conf \
--output-file=etc/mistral.conf.sample
[testenv:genpolicy]
description =
Build policy.yaml sample file.
commands =
oslopolicy-sample-generator \
--config-file=tools/config/policy-generator.mistral.conf \
--output-file=etc/policy.yaml.sample
[testenv:venv]
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
commands =
{posargs}
[testenv:docs]
description =
Build main documentation.
deps =
-r{toxinidir}/doc/requirements.txt
-r{toxinidir}/requirements.txt
allowlist_externals =
rm
commands =
rm -rf doc/build
sphinx-build -E -W --keep-going -b html doc/source doc/build/html
[testenv:pdf-docs]
description =
Build PDF documentation.
deps = {[testenv:docs]deps}
allowlist_externals =
rm
make
commands =
rm -rf doc/build/pdf
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:releasenotes]
description =
Generate release notes.
deps = {[testenv:docs]deps}
allowlist_externals =
rm
commands =
rm -rf releasenotes/build
sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html
[testenv:api-ref]
description =
Generate the API ref. Called from CI scripts to test and publish to docs.openstack.org.
deps = {[testenv:docs]deps}
allowlist_externals =
rm
commands =
rm -rf api-ref/build
sphinx-build -W --keep-going -b html -j auto api-ref/source api-ref/build/html
#Skip PEP257 violation.
[flake8]
ignore = D100,D101,D102,D103,D104,D105,D200,D203,D202,D204,D205,D208,D400,D401,E402,W503,E731,W504
show-source = true
builtins = _
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H904] Delay string interpolations at logging calls.
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,scripts
[doc8]
extensions = .rst, .yaml, .mistral
# Maximal line length should be 80.
max-line-length = 80
[hacking]
import_exceptions = mistral._i18n
[flake8:local-plugins]
extension =
M001 = checks:CheckForLoggingIssues
M319 = checks:no_assert_equal_true_false
M320 = checks:no_assert_true_false_is_not
M327 = checks:check_python3_xrange
M328 = checks:check_python3_no_iteritems
M329 = checks:check_python3_no_iterkeys
M330 = checks:check_python3_no_itervalues
O323 = checks:check_oslo_namespace_imports
paths = ./mistral/hacking