osc-lib/tox.ini
Stephen Finucane be8e6ba4fa tox: Use pre-commit for style checks
Change-Id: Ibe29f450c67c2297b659bd3c0b3b3b0d4d5e13a8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-11-15 10:06:18 +00:00

80 lines
2.5 KiB
INI

[tox]
minversion = 3.1
envlist = py3,pep8
[testenv]
setenv =
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
stestr run {posargs}
[testenv:unit-tips]
commands =
python -m pip install -q -e "git+file://{toxinidir}/../cliff#egg=cliff"
python -m pip install -q -e "git+file://{toxinidir}/../keystoneauth#egg=keystoneauth"
python -m pip install -q -e "git+file://{toxinidir}/../openstacksdk#egg=openstacksdk"
python -m pip freeze
stestr run {posargs}
[testenv:pep8]
description =
Run style checks.
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[testenv:venv]
commands =
{posargs}
[testenv:cover]
commands =
python setup.py test --coverage --coverage-package-name=osc_lib --testr-args='{posargs}'
coverage report
[testenv:debug]
commands =
oslo_debug_helper -t osc_lib/tests {posargs}
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-apidoc -o doc/api osc_lib osc_lib/tests
# Create ChangeLog file
python setup.py sdist
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
[testenv:releasenotes]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[flake8]
show-source = True
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools
# 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
application-import-names = osc_lib