patrole/tox.ini
zhangboye e3a7ce27a2 Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.

Change-Id: Ie18dd47beef0d15e168c3284c4cf0d3564467eff
2021-04-20 16:54:05 +08:00

135 lines
4.5 KiB
INI

[tox]
minversion = 3.18.0
envlist = pep8,py3
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
OS_TEST_PATH=./patrole_tempest_plugin/tests/unit
LANGUAGE=en_US
LC_ALL=en_US.utf-8
PYTHONWARNINGS=default::DeprecationWarning
passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
allowlist_externals = find
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 "*.pyc" -delete
stestr --test-path ./patrole_tempest_plugin/tests/unit run {posargs}
description=Runs the {envname} environment
[testenv:pep8]
deps =
-r{toxinidir}/test-requirements.txt
commands =
flake8 {posargs}
bandit -r patrole_tempest_plugin -x patrole_tempest_plugin/tests -n 5
check-uuid --package patrole_tempest_plugin.tests.api
description=Runs pep8 via flake 8 linting
[testenv:uuidgen]
commands = check-uuid --package patrole_tempest_plugin.tests.api --fix
description=Runs tempest uuidgen to make sure all test case have idempotent_id and generate one if not
[testenv:venv]
commands = {posargs}
description=Creates a virtual environment called venv with patrole installed
[testenv:cover]
commands = rm -rf *.pyc
rm -rf cover
rm -f .coverage
nosetests {posargs}
setenv = VIRTUAL_ENV={envdir}
NOSE_WITH_COVERAGE=1
NOSE_COVER_BRANCHES=1
NOSE_COVER_PACKAGE=patrole_tempest_plugin
NOSE_COVER_HTML=1
NOSE_COVER_HTML_DIR={toxinidir}/cover
NOSE_WHERE=patrole_tempest_plugin/tests/unit
allowlist_externals = nosetests
rm
description=Runs unit test code coverage report
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build doc/source/framework/code
sphinx-build -W -b html doc/source doc/build/html
allowlist_externals = rm
description=Generate patrole docs
[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
description=Generates patrole docs in PDF format
[testenv:releasenotes]
deps = {[testenv:docs]deps}
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
allowlist_externals = rm
description=Generate release notes
[testenv:debug]
commands = oslo_debug_helper -t patrole_tempest_plugin/tests {posargs}
description=Support running tests with pdb statements.
[testenv:genconfig]
commands = oslo-config-generator --config-file etc/config-generator.patrole.conf
description=Generate a sample configuration file
[flake8]
# [H106] Don't put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.
# [H204] Use assert(Not)Equal to check for equality.
# [H205] Use assert(Greater|Less)(Equal) for comparison.
# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
# [H904] Delay string interpolations at logging calls.
enable-extensions = H106,H203,H204,H205,H210,H904
show-source = True
# E123, E125 skipped as they are invalid PEP-8.
#
# H405 is another one that is good as a guideline, but sometimes
# multiline doc strings just don't have a natural summary
# line. Rejecting code for this reason is wrong.
# W504 line break after binary operator
ignore = E123,E125,H405,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[flake8:local-plugins]
extension =
T102 = checks:import_no_clients_in_api_tests
T105 = checks:no_setup_teardown_class_for_tests
T107 = checks:service_tags_not_in_module_path
T108 = checks:no_hyphen_at_end_of_rand_name
N322 = checks:no_mutable_default_args
T109 = checks:no_testtools_skip_decorator
T113 = checks:use_rand_uuid_instead_of_uuid4
P100 = checks:no_rbac_rule_validation_decorator
P101 = checks:no_rbac_suffix_in_test_filename
P102 = checks:no_rbac_test_suffix_in_test_class_name
P103 = checks:no_client_alias_in_test_cases
P104 = checks:no_extension_rbac_test_suffix_in_plugin_test_class_name
paths = ./patrole_tempest_plugin/hacking
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt