zun/tox.ini
Andreas Jaeger 3fe89808c6 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Remove hacking and friends from lower-constraints, they are not needed
to be installed at run-time.

Fix flake8wrap to take arguments from tox.ini and not look at .tox
directory.

Change-Id: I1c5f5a85af02d9f11e475b6088fe1d9d9d252083
2020-04-02 10:28:00 +02:00

175 lines
5.0 KiB
INI

[tox]
minversion = 2.0
envlist = py37,pep8,migration
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
whitelist_externals = bash
find
rm
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.py[c|o]" -delete
stestr run {posargs}
stestr slowest
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:pep8]
basepython = python3
commands =
doc8 -e .rst specs/ doc/source/ CONTRIBUTING.rst HACKING.rst README.rst
bash tools/flake8wrap.sh {posargs}
# The following bandit tests are being skipped:
# B303 - Use of insecure MD2, MD4, or MD5 hash function.
# B604 - unction call with shell=True parameter identified, possible security issue.
bandit -r zun -x tests -n5 -ll --skip B303,B604
[testenv:venv]
basepython = python3
#set PYTHONHASHSEED=0 to prevent oslo_policy.sphinxext from randomly failing.
setenv = PYTHONHASHSEED=0
commands = {posargs}
[testenv:cover]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage run --source zun --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -W -d doc/build/doctrees -b html doc/source/ doc/build/html
[testenv:pdf-docs]
basepython = python3
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
whitelist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}
[testenv:debug-py36]
basepython = python3.6
commands = oslo_debug_helper {posargs}
[testenv:migration]
basepython = python3
setenv = {[testenv]setenv}
OS_TEST_PATH=./zun/tests/migration
deps = {[testenv]deps}
commands =
find . -type f -name "*.py[c|o]" -delete
stestr run {posargs}
stestr slowest
[flake8]
filename = *.py,app.wsgi
show-source = True
# [H904] Delay string interpolations at logging calls.
enable-extensions = H203,H106,H904
# H405 is another one that is good as a guideline, but sometimes
# multiline docstrings just don't have a natural summary line.
# Rejecting code for this reason is wrong.
# W503 line break before binary operator
# W504 line break after binary operator
# E402 module level import not at top of file
ignore = E123,E125,H405,W503,W504,E402
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,zun/criapi/
[flake8:local-plugins]
extension =
Z322 = checks:no_mutable_default_args
Z323 = checks:assert_equal_true_or_false
Z302 = checks:assert_equal_not_none
Z316 = checks:assert_true_isinstance
Z338 = checks:assert_equal_in
Z310 = checks:use_timeutils_utcnow
Z336 = checks:dict_constructor_with_list_copy
Z339 = checks:no_xrange
Z352 = checks:no_log_warn
Z353 = checks:no_translate_logs
paths = ./zun/hacking
[testenv:fast8]
basepython = python3
# NOTE(sheel.rana): `tox -e fast8` cab be used to run pep8 command only for
# updated code instead for running whole code base.
# Use same environment directory as pep8 env to save space and install time.
envdir = {toxworkdir}/pep8
commands =
{toxinidir}/tools/fast8.sh
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:genconfig]
basepython = python3
envdir = {toxworkdir}/venv
commands =
oslo-config-generator --config-file etc/zun/zun-config-generator.conf
[testenv:genpolicy]
basepython = python3
commands =
oslopolicy-sample-generator --config-file etc/zun/zun-policy-generator.conf
[testenv:api-ref]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:lower-constraints]
basepython = python3
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
# This environment can be used to quickly validate that all needed system
# packages required to successfully execute test targets are installed
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:fullstack]
basepython = python3
setenv = {[testenv]setenv}
deps = {[testenv]deps}
commands =
stestr --test-path=./zun/tests/fullstack run {posargs}
stestr slowest