-
Notifications
You must be signed in to change notification settings - Fork 200
/
tox.ini
259 lines (232 loc) · 6.31 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
[tox]
envlist = flake8, pylint, reuse, tests, storage-user, storage-root, lib, network, virt, gluster, hooks
skipsdist = true
skip_missing_interpreters = True
[testenv]
basepython=python3
sitepackages = True
whitelist_externals = profile
[base]
passenv = *
setenv =
PYTHONPATH = {toxinidir}/lib
LC_ALL = C.UTF8
deps =
nose==1.3.7
pytest
pytest-cov
pytest-timeout
packaging
changedir = {toxinidir}/tests
markers = "not (integration or slow or stress)"
# PYTHONHASHSEED: Using random hash seed expose bad tests assuming order of
# unorder things.
# TODO: remove this option after the failing tests are fixed.
[testenv:tests]
passenv =
{[base]passenv}
setenv =
{[base]setenv}
PYTHONHASHSEED = 0
deps =
{[base]deps}
yappi
whitelist_externals = make
changedir = {[base]changedir}
commands =
python profile {envname} make check
[testenv:lib]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-lib
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers} --durations=10 {posargs} \
--cov=vdsm \
--cov=yajsonrpc \
--cov-report=html:htmlcov-lib \
common/commands_test.py \
common/concurrent_test.py \
common/properties_test.py \
common/systemctl_test.py \
common/systemd_test.py \
common/time_test.py \
lib/ \
hooking_test.py \
prlimit_test.py \
pywatch_test.py \
ssl_test.py \
tool_configurators_lvm_test.py
[testenv:network]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-network
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.network \
--cov-report=html:htmlcov-network \
--cov-fail-under={env:NETWORK_COVERAGE:42} \
{posargs} \
network/integration \
network/unit
[testenv:storage-user]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-storage-user
deps = {[base]deps}
userstorage>=0.5.1
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers}" and not root" \
--durations=20 \
--cov=vdsm.storage \
--cov-report=html:htmlcov-storage-user \
--cov-fail-under={env:STORAGE_USER_COVERAGE:61} \
{posargs:storage}
[testenv:storage-root]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-storage-root
deps = {[base]deps}
userstorage>=0.5.1
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers}" and root" \
--durations=20 \
--cov=vdsm.storage \
--cov-report=html:htmlcov-storage-root \
--cov-fail-under={env:STORAGE_ROOT_COVERAGE:47} \
{posargs:storage}
[testenv:virt]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-virt
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.virt \
--cov-report=html:htmlcov-virt \
{posargs:virt}
[testenv:gluster]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-gluster
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest \
--durations=5 \
--cov=vdsm.gluster \
--cov-report=html:htmlcov-gluster \
{posargs:gluster}
[testenv:hooks]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-hooks
PYTHONPATH = {toxinidir}/lib:{toxinidir}/lib/vdsm/hook:{toxinidir}/vdsm_hooks
deps = {[base]deps}
changedir = {[base]changedir}
commands =
python profile {envname} pytest -m {[base]markers} --durations=10 {posargs} \
hooks
[testenv:pylint]
setenv =
PYTHONPATH = vdsm:lib
deps =
pylint~=2.10.0
commands =
python {toxinidir}/tests/profile {envname} pylint -j{env:PYLINT_JOBS:4} --reports=no --score=no {posargs}
[testenv:flake8]
deps =
flake8==3.9.2
commands=
python {toxinidir}/tests/profile {envname} flake8 --statistics {posargs} \
lib \
tests \
vdsm_hooks \
contrib \
build-aux/vercmp \
contrib/logdb \
contrib/logstat \
contrib/lvs-stats \
contrib/profile-stats \
init/daemonAdapter \
lib/vdsm/storage/curl-img-wrap \
lib/vdsm/storage/fc-scan \
static/libexec/vdsm/get-conf-item \
static/usr/bin/vdsm-tool
[testenv:black]
sitepackages = false
skip_install = true
deps =
black==22.3.0
commands =
black \
-l 79 \
-S \
--check \
--diff \
{posargs} \
./lib/vdsm/network/ \
./tests/network
[reuse]
deps =
reuse
commands =
reuse lint
[pytest]
# -r chars: (s)skipped, (x)failed, (X)passed
# --strict-markers: ensure no unregistered markers are used
addopts = -rxXs --basetemp=/var/tmp/vdsm --strict-markers
# Registration of all pytest markers (e.g., pytest.mark.slow)
# https://docs.pytest.org/en/latest/mark.html
markers =
integration
legacy_switch
ovs_switch
root
slow
stress
# Fail if test marks as xfail succeeds. To handle flaky tests You can override
# the value:
# @pytest.mark.xfail(reason="Fails randomly" strict=False)
xfail_strict = True
# Include time with pytest logs for easier identification of related events
log_format=%(asctime)s,%(msecs)03d %(levelname)-7s (%(threadName)s) [%(name)s] %(message)s (%(module)s:%(lineno)d)
log_level=DEBUG
# Kill test process if a test is too slow. Slow tests can override this
# value using:
#
# @pytest.mark.timeout(60)
# def very_slow_test():
#
timeout = 30
# Fail by kiling the test process from another thread.
timeout_method = thread
[flake8]
# Ignore errors in current code to make the build pass
# TODO: fix the code and eliminate these ignores:
# - 18 E731 do not assign a lambda expression, use a def
# - 151 E722 do not use bare 'except'
# - 238 W504 line break after binary operator
#
# The following test must be skipped as this rule goes against the
# PEP 8 recommended style, which was changed on April 16th, 2016:
# - W503 line break before binary operator
ignore = E731, E722, W504, W503
show_source = True