codegenerator/tox.ini
Artem Goncharov e3dda1cbc3 Adopt uv instead of pip
- fix pyproject.toml file name (causing few reformats missed previously)
- extend pyproject.toml with the info from setup.cfg to make uv work
- introduce uv and start using it inside tox
- fix unittest that started failing due to that change

Change-Id: I461ffc9fee39085f795ced07b7d00ebde28a6034
2025-04-03 17:03:47 +02:00

92 lines
3.0 KiB
INI

[tox]
requires =
tox>=4.2
tox-uv>=1.11.3
minversion = 4.3.0
envlist = pep8,py312
ignore_basepython_conflict=True
[testenv]
description =
Run unit tests.
package = editable
passenv =
setenv =
LANG=en_US.UTF-8
LANGUAGE=en_US:en
extras = test
commands =
# A very dirty hack to bypass dependency conflict of openapi-core/jsonchema/referencing
uv pip install -U openapi-core
stestr run {posargs}
stestr slowest
[testenv:functional{,-py310,-py311,-py312}]
description =
Run functional tests.
setenv =
{[testenv]setenv}
commands =
# Generators conflict with each other since every service is screwing
# OsloConfig to its own flavor and I have not found a working way to deal with
# that except of physically isolating them
stestr --test-path ./codegenerator/tests/functional/ run {posargs}
stestr slowest
[testenv:docs{,-py310,-py311,-py312}]
description =
Build documentation in HTML format.
# We do not want the package (because of heavy dependencies for docs)
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
pip
commands =
sphinx-build -W --keep-going -b html -j auto doc/source/ doc/build/html
[testenv:releasenotes{,-py310,-py311,-py312}]
# We do not want the package (because of heavy dependencies for docs)
skip_install = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
pip
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:pep8]
description =
Run style checks.
deps =
pre-commit-uv>=4.1.3
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:publish-openapi-specs]
description =
No-op env for publishing built Specs
skip_install = True
deps =
# We need any dependency, since only that causes `tox -epublish --notest` to create log dir that is required by tox-siblings role
pip
commands =
[flake8]
application-import-names = codegenerator
# The following are ignored on purpose. It's not super worth it to fix them.
# However, if you feel strongly about it, patches will be accepted to fix them
# if they fix ALL of the occurances of one and only one of them.
# E203 Black will put spaces after colons in list comprehensions
# E501 Black takes care of line length for us
# H238 New Style Classes are the default in Python3
# H301 Black will put commas after imports that can't fit on one line
# H4 Are about docstrings and there's just a huge pile of pre-existing issues.
# W503 Is supposed to be off by default but in the latest pycodestyle isn't.
# Also, both openstacksdk and Donald Knuth disagree with the rule. Line
# breaks should occur before the binary operator for readability.
ignore = E203, E501, H301, H238, H4, W503
import-order-style = pep8
show-source = True
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,