blob: b0c703a643788e22113f9af654a33c49c88b2641 [file] [log] [blame]
DavidPurcell663aedf2017-01-03 10:01:14 -05001[tox]
Ghanshyam Mann51368ef2020-02-03 13:19:03 -06002minversion = 3.1.1
Vishakha Agarwal15d8f262020-05-05 13:23:05 +05303envlist = pep8,py36,py38
DavidPurcell663aedf2017-01-03 10:01:14 -05004skipsdist = True
Ghanshyam Mann51368ef2020-02-03 13:19:03 -06005ignore_basepython_conflict = True
DavidPurcell663aedf2017-01-03 10:01:14 -05006
7[testenv]
Ghanshyam Mann51368ef2020-02-03 13:19:03 -06008basepython = python3
DavidPurcell663aedf2017-01-03 10:01:14 -05009usedevelop = True
DavidPurcell663aedf2017-01-03 10:01:14 -050010setenv =
11 VIRTUAL_ENV={envdir}
Felipe Monteiro7de19052017-08-06 05:47:27 +010012 OS_TEST_PATH=./patrole_tempest_plugin/tests/unit
13 LANGUAGE=en_US
14 LC_ALL=en_US.utf-8
DavidPurcell663aedf2017-01-03 10:01:14 -050015 PYTHONWARNINGS=default::DeprecationWarning
Felipe Monteiro5fa20f72017-12-01 02:09:08 +000016passenv = 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
Felipe Monteirodf958702017-02-27 03:53:50 +000017whitelist_externals = find
Andreas Jaegerd69a6362020-04-21 07:39:05 +020018deps =
19 -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
20 -r{toxinidir}/requirements.txt
21 -r{toxinidir}/test-requirements.txt
Jeremy Liue1014be2017-03-22 18:33:00 -070022commands =
DavidPurcell029d8c32017-01-06 15:27:41 -050023 find . -type f -name "*.pyc" -delete
Felipe Monteiro5fa20f72017-12-01 02:09:08 +000024 stestr --test-path ./patrole_tempest_plugin/tests/unit run {posargs}
Doug Schveningerff2fba22020-08-24 18:52:37 -050025description=Runs the {envname} environment
DavidPurcell663aedf2017-01-03 10:01:14 -050026
27[testenv:pep8]
Gage Hugo0f73e7c2018-08-21 15:51:08 -050028deps =
29 -r{toxinidir}/test-requirements.txt
30commands =
31 flake8 {posargs}
32 bandit -r patrole_tempest_plugin -x patrole_tempest_plugin/tests -n 5
33 check-uuid --package patrole_tempest_plugin.tests.api
Doug Schveningerff2fba22020-08-24 18:52:37 -050034description=Runs pep8 via flake 8 linting
Felipe Monteirodf958702017-02-27 03:53:50 +000035
36[testenv:uuidgen]
Jeremy Liu78b19252017-04-01 16:19:09 +080037commands = check-uuid --package patrole_tempest_plugin.tests.api --fix
Doug Schveningerff2fba22020-08-24 18:52:37 -050038description=Runs tempest uuidgen to make sure all test case have idempotent_id and generate one if not
DavidPurcell663aedf2017-01-03 10:01:14 -050039
40[testenv:venv]
41commands = {posargs}
Doug Schveningerff2fba22020-08-24 18:52:37 -050042description=Creates a virtual environment called venv with patrole installed
DavidPurcell663aedf2017-01-03 10:01:14 -050043
44[testenv:cover]
Joseph Abadae7d7bb2017-04-19 12:07:13 -040045commands = rm -rf *.pyc
46 rm -rf cover
47 rm -f .coverage
48 nosetests {posargs}
Felipe Monteiro1ee5f4d2017-03-04 18:07:27 +000049setenv = VIRTUAL_ENV={envdir}
50 NOSE_WITH_COVERAGE=1
51 NOSE_COVER_BRANCHES=1
52 NOSE_COVER_PACKAGE=patrole_tempest_plugin
53 NOSE_COVER_HTML=1
54 NOSE_COVER_HTML_DIR={toxinidir}/cover
55 NOSE_WHERE=patrole_tempest_plugin/tests/unit
56whitelist_externals = nosetests
Joseph Abadae7d7bb2017-04-19 12:07:13 -040057 rm
Doug Schveningerff2fba22020-08-24 18:52:37 -050058description=Runs unit test code coverage report
DavidPurcell663aedf2017-01-03 10:01:14 -050059
60[testenv:docs]
ghanshyam932b81d2018-03-14 02:07:33 +000061deps =
pengyuesheng8c23e7a2019-09-29 10:17:59 +080062 -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
ghanshyam932b81d2018-03-14 02:07:33 +000063 -r{toxinidir}/requirements.txt
64 -r{toxinidir}/doc/requirements.txt
65commands =
Felipe Monteiro47c43cb2018-11-05 17:15:30 +000066 rm -rf doc/build doc/source/framework/code
ghanshyam932b81d2018-03-14 02:07:33 +000067 sphinx-build -W -b html doc/source doc/build/html
68whitelist_externals = rm
Doug Schveningerff2fba22020-08-24 18:52:37 -050069description=Generate patrole docs
DavidPurcell663aedf2017-01-03 10:01:14 -050070
Masayuki Igawa94e6b182019-09-18 15:08:56 +090071[testenv:pdf-docs]
Masayuki Igawa94e6b182019-09-18 15:08:56 +090072deps = {[testenv:docs]deps}
73whitelist_externals =
74 make
75commands =
76 sphinx-build -W -b latex doc/source doc/build/pdf
77 make -C doc/build/pdf
Doug Schveningerff2fba22020-08-24 18:52:37 -050078description=Generates patrole docs in PDF format
Masayuki Igawa94e6b182019-09-18 15:08:56 +090079
DavidPurcell663aedf2017-01-03 10:01:14 -050080[testenv:releasenotes]
Andreas Jaegerd69a6362020-04-21 07:39:05 +020081deps = {[testenv:docs]deps}
DavidPurcell663aedf2017-01-03 10:01:14 -050082commands =
ghanshyam932b81d2018-03-14 02:07:33 +000083 rm -rf releasenotes/build
DavidPurcell663aedf2017-01-03 10:01:14 -050084 sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
ghanshyam932b81d2018-03-14 02:07:33 +000085whitelist_externals = rm
Doug Schveningerff2fba22020-08-24 18:52:37 -050086description=Generate release notes
DavidPurcell663aedf2017-01-03 10:01:14 -050087
88[testenv:debug]
HaiJieZhangae9db6f2017-03-23 11:28:16 +080089commands = oslo_debug_helper -t patrole_tempest_plugin/tests {posargs}
Doug Schveningerff2fba22020-08-24 18:52:37 -050090description=Support running tests with pdb statements.
DavidPurcell663aedf2017-01-03 10:01:14 -050091
Felipe Monteiro098a8cd2017-09-20 21:31:27 +010092[testenv:genconfig]
93commands = oslo-config-generator --config-file etc/config-generator.patrole.conf
Doug Schveningerff2fba22020-08-24 18:52:37 -050094description=Generate a sample configuration file
Felipe Monteiro098a8cd2017-09-20 21:31:27 +010095
DavidPurcell663aedf2017-01-03 10:01:14 -050096[flake8]
melissaml686e0d92018-01-26 01:07:42 +080097# [H106] Don't put vim configuration in source files.
Felipe Monteirob18a3f62017-09-19 04:25:51 +010098# [H203] Use assertIs(Not)None to check for None.
99# [H204] Use assert(Not)Equal to check for equality.
100# [H205] Use assert(Greater|Less)(Equal) for comparison.
melissaml686e0d92018-01-26 01:07:42 +0800101# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
Felipe Monteirob18a3f62017-09-19 04:25:51 +0100102# [H904] Delay string interpolations at logging calls.
103enable-extensions = H106,H203,H204,H205,H210,H904
DavidPurcell663aedf2017-01-03 10:01:14 -0500104show-source = True
Felipe Monteiro4bf66a22017-05-07 14:44:21 +0100105# E123, E125 skipped as they are invalid PEP-8.
Felipe Monteirof6eb8622017-08-06 06:08:02 +0100106#
107# H405 is another one that is good as a guideline, but sometimes
108# multiline doc strings just don't have a natural summary
109# line. Rejecting code for this reason is wrong.
Andreas Jaeger2aad8082020-03-28 19:25:15 +0100110# W504 line break after binary operator
111ignore = E123,E125,H405,W504
DavidPurcell663aedf2017-01-03 10:01:14 -0500112builtins = _
113exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
Felipe Monteiro0854ded2017-05-05 16:30:55 +0100114
Andreas Jaeger2aad8082020-03-28 19:25:15 +0100115[flake8:local-plugins]
116extension =
117 T102 = checks:import_no_clients_in_api_tests
118 T105 = checks:no_setup_teardown_class_for_tests
119 T107 = checks:service_tags_not_in_module_path
120 T108 = checks:no_hyphen_at_end_of_rand_name
121 N322 = checks:no_mutable_default_args
122 T109 = checks:no_testtools_skip_decorator
123 T113 = checks:use_rand_uuid_instead_of_uuid4
124 P100 = checks:no_rbac_rule_validation_decorator
125 P101 = checks:no_rbac_suffix_in_test_filename
126 P102 = checks:no_rbac_test_suffix_in_test_class_name
127 P103 = checks:no_client_alias_in_test_cases
128 P104 = checks:no_extension_rbac_test_suffix_in_plugin_test_class_name
129paths = ./patrole_tempest_plugin/hacking
Doug Hellmann8669a512018-03-22 17:42:03 -0400130
131[testenv:lower-constraints]
Doug Hellmann8669a512018-03-22 17:42:03 -0400132deps =
133 -c{toxinidir}/lower-constraints.txt
134 -r{toxinidir}/test-requirements.txt
135 -r{toxinidir}/requirements.txt