Files
grian-ui/tox.ini
Sean Mooney 4ff0d6c976 Add basic docs and runserver command
This commit provides some basic docs on how the
repo works. These shoudl be moved to contibutor
docs later once we have a devstack plugin and
a working install procedure. For now they
are stored in the README of discoverablity.

This change also provide a minimal settings.py
to be used in conjunction with a new
``tox -e runserver`` command. this will run
a local development instance of horizon using in memory
caching an signed cookies for session management.

in the future we may evolve this to run without
all of horizon or modify it based on how the plugin
develops once we have a working devstack jobs.

An example local.conf is also provided which deploys
nova, neutron, placement, keystone, glance an horizon.
addtionally promethus, ceilometer and sg-core are deployed
to provide metrics.

Change-Id: If9f38d88efccd29a63dd2aba4edd56f5f9fa1933
2025-05-26 16:55:47 +00:00

145 lines
4.1 KiB
INI

[tox]
minversion = 3.18.0
envlist = pep8,unit,docs,releasenotes
[testenv]
usedevelop = True
allowlist_externals =
bash
find
rm
env
make
./manage.py
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}
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
DJANGO_SETTINGS_MODULE
commands =
stestr run {posargs}
stestr slowest
[testenv:{pep8,lint}]
description =
Run style checks.
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:{unit,py3,py310,py311,py312,py313}]
description =
Run granular unit tests without horizon.
set_env =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=grian_ui_tests.unit.settings
[testenv:functional{,-py310,-py311,-py312,-py313}]
description =
Run higher level functional tests with horizon.
set_env =
{[testenv]setenv}
DJANGO_SETTINGS_MODULE=grian_ui_tests.functional.settings
commands =
stestr --test-path={toxinidir}/tests/grian_ui_tests/functional run {posargs}
stestr slowest
[testenv:venv]
description =
A virtual env with all deps installed.
deps =
{[testenv]deps}
-r{toxinidir}/doc/requirements.txt
commands =
{posargs}
[testenv:releasenotes]
description =
Generate Release notes.
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 as html.
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
[testenv:runserver]
description =
run horizon with grian ui enabled.
deps =
{[testenv]deps}
commands =
./manage.py runserver
[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