Fix tox4 error when passenv value
[transportpce.git] / tox.ini
1 [tox]
2 minversion = 3.7.0
3 envlist = buildcontroller,testsPCE,
4     sims121,build_karaf_tests121,tests121,
5     sims221,build_karaf_tests221,tests221,tests_tapi,
6     sims71,build_karaf_tests71,tests71,
7     build_karaf_tests_hybrid,tests_hybrid,
8     docs
9     docs-linkcheck
10     checkbashisms
11     pre-commit
12     pylint
13 skipsdist = true
14 setupdir = tests/
15
16 [testenv]
17 passenv =
18     USE_LIGHTY
19     http_proxy
20     HTTP_PROXY
21     https_proxy
22     HTTPS_PROXY
23     no_proxy
24     NO_PROXY
25     OLM_TIMER1
26     OLM_TIMER2
27 setenv =
28     USE_LIGHTY=True
29     OLM_TIMER1=3000
30     OLM_TIMER2=2000
31
32 usedevelop = true
33 basepython = python3
34 deps =
35   -r{toxinidir}/tests/requirements.txt
36   -r{toxinidir}/tests/test-requirements.txt
37   setuptools>=7.0
38 changedir = {toxinidir}/tests
39 parallel_show_output = true
40
41 [testenv:buildcontroller]
42 allowlist_externals = build_controller.sh
43 commands =
44   ./build_controller.sh
45
46 [testenv:sims121]
47 allowlist_externals = install_honeynode.sh
48 depends = buildcontroller
49 # sims profiles does not strictly depends on buildcontroller
50 # but this dependency avoids race condition in the gate
51 commands =
52   ./install_honeynode.sh 1.2.1
53
54 [testenv:sims221]
55 allowlist_externals = install_honeynode.sh
56 depends = buildcontroller
57 commands =
58   ./install_honeynode.sh 2.2.1
59
60 [testenv:sims71]
61 allowlist_externals = install_honeynode.sh
62 depends = buildcontroller
63 commands =
64   ./install_honeynode.sh 7.1
65
66 [testenv:testsPCE]
67 depends = buildcontroller
68 #the following lines retrieve unofficial package of GNPy with REST support from Orange opensource Gitlab repo
69 setenv =
70     PIP_EXTRA_INDEX_URL = https://gitlab.com/api/v4/projects/33090323/packages/pypi/simple
71     USE_LIGHTY=True
72 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
73 deps =
74   -r{toxinidir}/tests/requirements.txt
75   -r{toxinidir}/tests/test-requirements.txt
76   setuptools>=7.0
77   gnpy4tpce==2.4.7
78 allowlist_externals = launch_tests.sh
79 passenv =
80     LAUNCHER
81     USE_LIGHTY
82     USE_ODL_RESTCONF_VERSION
83 basepython = python3
84 commands =
85   ./launch_tests.sh pce {posargs:}
86
87 [testenv:build_karaf_tests121]
88 depends = buildcontroller
89 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
90 allowlist_externals = launch_tests.sh
91 passenv =
92     LAUNCHER
93     USE_LIGHTY
94 setenv =
95     USE_LIGHTY=True
96     USE_ODL_ALT_KARAF_ENV=./karaf121.env
97     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
98 commands =
99   ./build_karaf_for_tests.sh
100
101 [testenv:tests121]
102 depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
103 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
104 allowlist_externals = launch_tests.sh
105 passenv =
106     LAUNCHER
107     USE_LIGHTY
108     USE_ODL_RESTCONF_VERSION
109 setenv =
110     USE_LIGHTY=True
111 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
112     USE_ODL_ALT_KARAF_ENV=./karaf121.env
113     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
114 commands =
115   ./launch_tests.sh 1.2.1 {posargs:}
116 # By default, all tests in the folder transportpce_tests/1.2.1/ are run.
117 # Though, a restricted list of tests can be passed as argument to 'tox -e tests121'.
118 # For example, 'tox -e tests121 portmapping' will run only the portmapping test.
119 # and 'tox -e tests121 "portmapping pce"' will run the portmapping and pce tests.
120 # Additionnally, a different launcher command than 'nosetests --with-xunit' can be
121 # used by exporting the variable LAUNCHER. For example 'export LAUNCHER="python3"'
122 # which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
123 # files attributes.
124
125 [testenv:build_karaf_tests221]
126 depends = buildcontroller
127 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
128 allowlist_externals = launch_tests.sh
129 passenv =
130     LAUNCHER
131     USE_LIGHTY
132 setenv =
133     USE_LIGHTY=True
134     USE_ODL_ALT_KARAF_ENV=./karaf221.env
135     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
136 commands =
137   ./build_karaf_for_tests.sh
138
139 [testenv:tests221]
140 depends = buildcontroller,build_karaf_tests221,sims221,tests71
141 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
142 allowlist_externals = launch_tests.sh
143 passenv =
144     LAUNCHER
145     USE_LIGHTY
146     USE_ODL_RESTCONF_VERSION
147 setenv =
148     USE_LIGHTY=True
149 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
150     USE_ODL_ALT_KARAF_ENV=./karaf221.env
151     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
152 commands =
153   ./launch_tests.sh 2.2.1 {posargs:}
154
155 [testenv:build_karaf_tests71]
156 depends = buildcontroller
157 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
158 allowlist_externals = launch_tests.sh
159 passenv =
160     LAUNCHER
161     USE_LIGHTY
162 setenv =
163     USE_LIGHTY=True
164     USE_ODL_ALT_KARAF_ENV=./karaf71.env
165     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
166 commands =
167   ./build_karaf_for_tests.sh
168
169 [testenv:tests71]
170 depends = buildcontroller,build_karaf_tests71,sims71,tests_tapi
171 allowlist_externals = launch_tests.sh
172 passenv =
173     LAUNCHER
174     USE_LIGHTY
175     USE_ODL_RESTCONF_VERSION
176 setenv =
177     USE_LIGHTY=True
178 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
179     USE_ODL_ALT_KARAF_ENV=./karaf71.env
180     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
181 commands =
182   ./launch_tests.sh 7.1 {posargs:}
183
184 [testenv:build_karaf_tests_hybrid]
185 depends = buildcontroller
186 allowlist_externals = launch_tests.sh
187 passenv =
188     LAUNCHER
189     USE_LIGHTY
190 setenv =
191     USE_LIGHTY=True
192     USE_ODL_ALT_KARAF_ENV=./karaf121.env
193     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
194 commands =
195   ./build_karaf_for_tests.sh
196
197 [testenv:tests_hybrid]
198 depends = buildcontroller,build_karaf_tests_hybrid,sims121,sims221,sims71,tests121,tests221,tests71
199 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
200 allowlist_externals = launch_tests.sh
201 passenv =
202     LAUNCHER
203     USE_LIGHTY
204     USE_ODL_RESTCONF_VERSION
205 setenv =
206     USE_LIGHTY=True
207 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
208     USE_ODL_ALT_KARAF_ENV=./karaf121.env
209     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
210 commands =
211 #  nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
212   ./launch_tests.sh hybrid {posargs:}
213
214 [testenv:tests_tapi]
215 depends = buildcontroller,build_karaf_tests221,sims221
216 allowlist_externals = launch_tests.sh
217 passenv =
218     LAUNCHER
219     USE_LIGHTY
220     OLM_TIMER1
221     OLM_TIMER2
222     USE_ODL_RESTCONF_VERSION
223 setenv =
224     USE_LIGHTY=True
225 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
226     USE_ODL_ALT_KARAF_ENV=./karaf221.env
227     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
228     INSTALL_TAPI=True
229     OLM_TIMER1=3000
230     OLM_TIMER2=2000
231
232 commands =
233   ./launch_tests.sh tapi {posargs:}
234
235 [testenv:with_docker]
236 depends = buildcontroller,sims221
237 allowlist_externals = launch_tests.sh
238                       dockercmd.sh
239 passenv =
240     LAUNCHER
241     USE_LIGHTY
242     USE_ODL_RESTCONF_VERSION
243     OLM_TIMER1
244     OLM_TIMER2
245 setenv =
246     OLM_TIMER1=3000
247     OLM_TIMER2=2000
248     INSTALL_TAPI=True
249     INSTALL_NBINOTIFICATIONS=True
250 #    USE_ODL_RESTCONF_VERSION=draft-bierman02
251
252 commands =
253   ./dockercmd.sh run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --name tpce_kafka1 teivah/kafka:2.0.0
254   ./launch_tests.sh with_docker {posargs:}
255   ./dockercmd.sh container rm -f tpce_kafka1
256
257 [testenv:docs]
258 passenv =
259     http_proxy
260     HTTP_PROXY
261     https_proxy
262     HTTPS_PROXY
263     no_proxy
264     NO_PROXY
265 basepython = python3
266 deps = -rdocs/requirements.txt
267 commands =
268     sphinx-build -q -W --keep-going -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
269
270 [testenv:docs-linkcheck]
271 passenv =
272     http_proxy
273     HTTP_PROXY
274     https_proxy
275     HTTPS_PROXY
276     no_proxy
277     NO_PROXY
278 basepython = python3
279 deps = -rdocs/requirements.txt
280 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
281
282 [testenv:checkbashisms]
283 deps =
284 allowlist_externals = sh
285                       checkbashisms
286                       sudo
287                       find
288 commands =
289     sh -c 'command checkbashisms>/dev/null || sudo yum install -y devscripts-checkbashisms || sudo yum install -y devscripts-minimal || sudo yum install -y devscripts \
290         || sudo yum install -y https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Everything/x86_64/os/Packages/d/devscripts-checkbashisms-2.19.6-2.fc31.x86_64.rpm \
291         || (echo "checkbashisms command not found - please install it \
292              (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
293     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
294
295 [testenv:spelling]
296 basepython = python3
297 deps =
298     -rdocs/requirements.txt
299     sphinxcontrib-spelling
300     PyEnchant
301 commands = sphinx-build -b spelling -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
302
303 [testenv:autopep8]
304 basepython = python3
305 deps = autopep8
306 commands =
307     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
308
309 [testenv:pylint_full]
310 basepython = python3
311 deps = pylint>=2.6.0
312 allowlist_externals = find
313 commands =
314     find transportpce_tests/ -name *.py -exec pylint --fail-under=9.22 --max-line-length=120 --disable=missing-docstring --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y  --output-format=colorized  \{\} +
315
316 [testenv:pylint]
317 basepython = python3
318 deps = pylint>=2.6.0
319 allowlist_externals = find
320 commands =
321     find transportpce_tests/ -name *.py -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring --disable=fixme --disable=duplicate-code --module-rgx="([a-z0-9_]+$)|([0-9.]{1,30}$)" --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" \{\} +
322
323 [testenv:pyang]
324 basepython = python3
325 deps = pyang
326 allowlist_externals = find
327 commands =
328     pyang --version
329     find ../api/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
330 #find ../api/ ../ordmodels/ ../tapimodels/ -name target -prune -o -name *.yang -exec pyang --lint --canonical --max-line-length=120 -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ \{\} +
331
332 [testenv:pyangformat]
333 basepython = python3
334 deps = pyang
335 allowlist_externals = sh
336 commands =
337     pyang --version
338     sh -c 'find ../api/ -name target -prune -o -name *.yang -print | while read -r fname; do pyang -f yang --yang-canonical --yang-remove-unused-imports --max-line-length=120 --keep-comments -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ "$fname"  -o /tmp/tmpfile.$$ && mv /tmp/tmpfile.$$ "$fname";done'
339
340 [testenv:pre-commit-install]
341 basepython = python3
342 deps = pre-commit
343 commands =
344     pre-commit install
345     pre-commit install --hook-type commit-msg
346
347 [testenv:pre-commit-uninstall]
348 basepython = python3
349 deps = pre-commit
350 commands =
351     pre-commit uninstall
352     pre-commit uninstall --hook-type commit-msg
353
354 [testenv:pre-commit-autoupdate]
355 basepython = python3
356 deps = pre-commit
357 commands =
358     pre-commit autoupdate
359
360 [testenv:pre-commit]
361 basepython = python3
362 deps = pre-commit
363 passenv = HOME
364 commands =
365     pre-commit run --all-files --show-diff-on-failure
366     pre-commit run gitlint-ci --hook-stage manual
367
368 [testenv:gitlint]
369 basepython = python3
370 deps = gitlint
371 commands =
372     gitlint --config ../.gitlint
373
374
375 [testenv:allure-report-init]
376 basepython = python3
377 deps = allure-pytest>=2.10.0
378 # allure is under Apache License 2.0
379 allowlist_externals =
380     mkdir
381     sed
382 commands =
383     mkdir -p allure-report
384     sed -i_ '$a\allure-pytest # Apache License 2.0' ./test-requirements.txt
385
386
387 [testenv:allure-report-serve]
388 basepython = python3
389 allowlist_externals =
390     allure
391 commands =
392     allure serve "allure-report"