Add a new tox environment `pypi-check` that builds the source and wheel distributions and validates them with `twine check --strict` and `validate-pyproject`. This reproduces the upstream `test-release-openstack` CI job locally so packaging issues can be caught before pushing. Fix the two `.. TODO::` blocks in README.rst which are not valid reStructuredText directives and cause `twine check` to fail with: long_description has syntax errors in markup and would not be rendered on PyPI. line 12: Error: Unknown directive type "TODO". Replace them with standard RST comment blocks (`..`). Also fix a typo: s/exampel/example/. Generated-By: Claude-Code Sonnet 4.6 Change-Id: I4b857427f89b25fbc697d283c38bcd7c5d1417c3 Signed-off-by: Sean Mooney <work@seanmooney.info>
160 lines
4.5 KiB
INI
160 lines
4.5 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,py314}]
|
|
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,-py314}]
|
|
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
|
|
|
|
[testenv:pypi-check]
|
|
description =
|
|
Build the package and run twine and pyproject checks.
|
|
deps =
|
|
build
|
|
twine
|
|
validate-pyproject
|
|
allowlist_externals =
|
|
rm
|
|
commands =
|
|
rm -rf {toxinidir}/dist
|
|
python -m build --outdir {toxinidir}/dist {toxinidir}
|
|
twine check --strict {toxinidir}/dist/*
|
|
validate-pyproject {toxinidir}/pyproject.toml
|
|
|
|
|
|
[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
|