-
Notifications
You must be signed in to change notification settings - Fork 149
/
tox.ini
244 lines (215 loc) · 8.11 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
[tox]
minversion = 3.18.0
envlist = docs,py3,functional-py3,pep8,specs,pip-missing-reqs,pip-extra-reqs
ignore_basepython_conflict = True
[testenv]
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=always::DeprecationWarning
install_command =
pip install {opts} {packages}
allowlist_externals = find
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run {posargs}
stestr slowest
[testenv:api-ref]
# This environment is called from CI scripts to test and publish
# the API Ref to docs.openstack.org.
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
allowlist_externals = rm
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
[testenv:cover]
allowlist_externals = sh
setenv =
{[testenv]setenv}
PYTHON=coverage run --source octavia --parallel-mode
commands =
coverage erase
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/unit stestr run {posargs}'
sh -c 'OS_TEST_PATH={toxinidir}/octavia/tests/functional stestr run {posargs}'
coverage combine
# Generate a new HTML report with the combined results
# otherwise the HTML report will only show partial results
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report --fail-under=92 --skip-covered
[testenv:py3]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/unit
PYTHONWARNINGS=always::DeprecationWarning
[testenv:functional]
# This will use whatever 'basepython' is set to, so the name is ambiguous.
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
PYTHONWARNINGS=always::DeprecationWarning
[testenv:functional-py3]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py39]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py310]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py311]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:functional-py312]
setenv = OS_TEST_PATH={toxinidir}/octavia/tests/functional
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:pep8]
commands = flake8
# RST linter
doc8 --ignore-path doc/source/contributor/modules specs \
doc/source octavia CONSTITUTION.rst HACKING.rst README.rst \
TESTING.rst
# Run security linter
{[testenv:bandit]commands}
# Make sure specs follow our template
find . -type f -name "*.pyc" -delete
python -m unittest specs-tests.test_titles
sh ./tools/misc-sanity-checks.sh
{toxinidir}/tools/coding-checks.sh --pylint {posargs}
{toxinidir}/tools/check_unit_test_structure.sh
{[testenv:bashate]commands}
allowlist_externals =
sh
find
bash
{toxinidir}/tools/coding-checks.sh
{toxinidir}/tools/check_unit_test_structure.sh
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
allowlist_externals = rm
commands =
rm -rf doc/build api-guide/build api-ref/build doc/source/contributor/modules
sphinx-build -W -b html doc/source doc/build/html
sphinx-build -W -b html api-ref/source api-ref/build/html
[testenv:pdf-docs]
deps = {[testenv:docs]deps}
allowlist_externals =
make
rm
commands =
rm -rf doc/build/pdf
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:venv]
commands = {posargs}
[testenv:genconfig]
allowlist_externals = mkdir
commands =
mkdir -p etc/octavia
oslo-config-generator \
--config-file etc/config/octavia-config-generator.conf
[testenv:genpolicy]
allowlist_externals = mkdir
commands =
mkdir -p etc/octavia
oslopolicy-sample-generator \
--config-file etc/policy/octavia-policy-generator.conf
[testenv:specs]
allowlist_externals =
rm
find
commands =
find . -type f -name "*.pyc" -delete
python -m unittest specs-tests.test_titles
[testenv:bandit]
commands = bandit -r octavia -ll -ii -x tests
[flake8]
# [H104]: Empty file with only comments
# [W504]: Line break after binary operator
# [I202]: Additional newline in a group of imports.
ignore = H104,W504,I202
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
# [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
# [H904]: Delay string interpolations at logging calls
enable-extensions=H106,H203,H204,H205,H904
[testenv:bashate]
commands = bash -c "find {toxinidir} \
-not \( -type d -name .tox\* -prune \) \
-not \( -type d -name .venv\* -prune \) \
-type f \
-name \*.sh \
# [E005]: File does not begin with #! or have a .sh prefix
# [E006]: Check for lines longer than 79 columns
# [E042]: Local declaration hides errors
# [E043]: Arithmetic compound has inconsistent return semantics
-print0 | xargs -0 bashate -v -iE006 -eE005,E042,E043"
[hacking]
import_exceptions = octavia.i18n
[flake8:local-plugins]
extension =
O316 = checks:assert_true_instance
O318 = checks:assert_equal_or_not_none
O323 = checks:assert_equal_true_or_false
O324 = checks:no_mutable_default_args
O338 = checks:assert_equal_in
O339 = checks:no_log_warn
O341 = checks:no_translate_logs
O342 = checks:check_raised_localized_exceptions
O345 = checks:check_no_eventlet_imports
O346 = checks:check_line_continuation_no_backslash
O347 = checks:revert_must_have_kwargs
O348 = checks:check_no_logging_imports
paths =
./octavia/hacking
[doc8]
max-line-length = 79
[testenv:releasenotes]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
allowlist_externals = rm
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:requirements]
deps =
-egit+https://opendev.org/openstack/requirements#egg=openstack-requirements
allowlist_externals = sh
commands =
sh -c '{envdir}/src/openstack-requirements/playbooks/files/project-requirements-change.py --req {envdir}/src/openstack-requirements --local {toxinidir} master'
[testenv:pip-missing-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages
# this also means that pip-check-reqs must be installed separately, outside
# of the requirements.txt files
# pip-check-reqs 2.3.0 is broken with latest pip release (21.2.2), so cap it to
# a previous release. But the latest pip-check-reqs working release doesn't
# work with recent pip release, also cap pip to a release that is supported by
# pip-check-reqs). Those caps will be removed once
# https://github.com/r1chardj0n3s/pip-check-reqs/issues/66 is fixed.
deps = pip-check-reqs<=2.2.2
pip<=21.1.3
-r{toxinidir}/requirements.txt
commands =
pip-missing-reqs --ignore-file=octavia/tests/* octavia
[testenv:pip-extra-reqs]
# do not install test-requirements as that will pollute the virtualenv for
# determining missing packages
# this also means that pip-check-reqs must be installed separately, outside
# of the requirements.txt files
# pip-check-reqs 2.3.0 is broken with latest pip release (21.2.2), so cap it to
# a previous release. But the latest pip-check-reqs working release doesn't
# work with recent pip release, also cap pip to a release that is supported by
# pip-check-reqs). Those caps will be removed once
# https://github.com/r1chardj0n3s/pip-check-reqs/issues/66 is fixed.
deps = pip-check-reqs<=2.2.2
pip<=21.1.3
-r{toxinidir}/requirements.txt
commands =
pip-extra-reqs --ignore-file=octavia/tests/* octavia