forked from oVirt/vdsm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
232 lines (208 loc) · 5.63 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
[tox]
envlist = flake8, pylint, tests, storage, 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
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 \
pywatch_test.py \
prlimit_test.py \
ssl_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]
passenv = {[base]passenv}
setenv =
{[base]setenv}
COVERAGE_FILE=.coverage-storage
deps = {[base]deps}
changedir = {[base]changedir}
# TODO: Remove --ignore
commands =
python profile {envname} pytest -m {[base]markers} \
--durations=20 \
--cov=vdsm.storage \
--cov-report=html:htmlcov-storage \
--cov-fail-under={env:STORAGE_COVERAGE:68} \
{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==21.6b0
commands =
black \
-l 79 \
-S \
--check \
--diff \
{posargs} \
./lib/vdsm/network/ \
./tests/network
[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