Files
grian-ui/tox.ini
Sean Mooney 8346769c9b set up basic unittesting
this chnage setup up unit testing with
stestr as the test runner and
django.test.SimpleTestCase as the base of our tests.

This avoid the depency on manage.py or run_tests.sh

Change-Id: Ib39d20861928a3052eaa9e9adc3f984ae20aad03
2025-05-19 23:51:57 +00:00

118 lines
3.5 KiB
INI

[tox]
minversion = 3.18.0
envlist = pep8,unit,docs,releasenotes
[testenv]
usedevelop = True
allowlist_externals =
bash
find
rm
env
make
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
# this is required to make the tests available
# as they are not part of the package.
PYTHONPATH = {toxinidir}/tests:{envdir}
DJANGO_SETTINGS_MODULE=grian_ui_tests.unit.settings
deps =
-r requirements.txt
-r{toxinidir}/test-requirements.txt
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
GENERATE_HASHES
# Note(sean-k-mooney):
# leaking greanthreads between tests is a bug so we should fail if it happens
# however unlike greenthreads, greenlets cannot be killed via a test fixture.
# greenlet leaks will be annotated in the test details but will not cause a
# failure. if you want to make them raise set
# NOVA_RAISE_ON_GREENLET_LEAK=1|true|yes
# All leaks of green threads have been resolved in the unit and functional
# suite
NOVA_RAISE_ON_GREENLET_LEAK
# NOTE(sean-k-mooney) optimization is enabled by default and when enabled
# asserts are complied out. Disable optimization to allow asserts in
# nova to fire in unit and functional tests. This can be useful for
# debugging issue with fixtures and mocks.
PYTHONOPTIMIZE
# there is also secret magic in subunit-trace which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
TRACE_FAILONLY
commands =
stestr run {posargs}
stestr slowest
[testenv:pep8]
description =
Run style checks.
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:{unit,py3,py310,py311,py312,py313}]
set_env =
{[testenv]setenv}
[testenv:venv]
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
commands =
{posargs}
[testenv:releasenotes]
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:docs]
description =
Build all documentation including API guides and refs.
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -W --keep-going -b html -j auto doc/source doc/build/html
[testenv:pdf-docs]
description =
Build PDF documentation.
deps = {[testenv:docs]deps}
extras =
commands =
rm -rf doc/build/pdf
sphinx-build -W --keep-going -b latex -j auto doc/source doc/build/pdf
make -C doc/build/pdf
[flake8]
# We only enable the hacking (H) and local checks (N)
select = H,N
filename = *.py,app.wsgi
show-source=True
# W504 line break after binary operator
# H301 Black will put commas after imports that can't fit on one line
# H404 Docstrings don't always start with a newline
# H405 Multiline docstrings are okay
# H105 disable blocking author tags
# H202 assertRaises Exception too broad
# H104: File contains nothing but comments
ignore = H301,H403,H404,H405,H105,H202,H104
builtins= _
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes