Fix some pylint warnings
[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,
6     sims71,build_karaf_tests71,tests71,
7     build_karaf_tests_hybrid,tests_hybrid,
8     docs
9     docs-linkcheck
10     checkbashisms
11     pre-commit
12     gitlint
13 skipsdist = true
14 setupdir = tests/
15
16 [testenv]
17 passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
18 #setenv =
19 #    USE_LIGHTY=True
20 usedevelop = true
21 basepython = python3
22 deps =
23   -r{toxinidir}/tests/requirements.txt
24   -r{toxinidir}/tests/test-requirements.txt
25   setuptools>=7.0
26 changedir = {toxinidir}/tests
27 parallel_show_output = true
28
29 [testenv:buildcontroller]
30 whitelist_externals = build_controller.sh
31 commands =
32   ./build_controller.sh
33
34 [testenv:sims121]
35 whitelist_externals = install_honeynode.sh
36 depends = buildcontroller
37 # sims profiles does not strictly depends on buildcontroller
38 # but this dependency avoids race condition in the gate
39 commands =
40   ./install_honeynode.sh 1.2.1
41
42 [testenv:sims221]
43 whitelist_externals = install_honeynode.sh
44 depends = buildcontroller
45 commands =
46   ./install_honeynode.sh 2.2.1
47
48 [testenv:sims71]
49 whitelist_externals = install_honeynode.sh
50 depends = buildcontroller
51 commands =
52   ./install_honeynode.sh 7.1
53
54 [testenv:testsPCE]
55 depends = buildcontroller
56 whitelist_externals = launch_tests.sh
57 passenv = LAUNCHER USE_LIGHTY
58 #setenv =
59 #    USE_LIGHTY=True
60 commands =
61   ./launch_tests.sh pce {posargs:}
62
63 [testenv:build_karaf_tests121]
64 depends = buildcontroller
65 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
66 whitelist_externals = launch_tests.sh
67 passenv = LAUNCHER USE_LIGHTY
68 setenv =
69 #    USE_LIGHTY=True
70     USE_ODL_ALT_KARAF_ENV=./karaf121.env
71     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
72 commands =
73   ./build_karaf_for_tests.sh
74
75 [testenv:tests121]
76 depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
77 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
78 whitelist_externals = launch_tests.sh
79 passenv = LAUNCHER USE_LIGHTY
80 setenv =
81 #    USE_LIGHTY=True
82     USE_ODL_ALT_KARAF_ENV=./karaf121.env
83     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
84 commands =
85   ./launch_tests.sh 1.2.1 {posargs:}
86 # By default, all tests in the folder transportpce_tests/1.2.1/ are run.
87 # Though, a restricted list of tests can be passed as argument to 'tox -e tests121'.
88 # For example, 'tox -e tests121 portmapping' will run only the portmapping test.
89 # and 'tox -e tests121 "portmapping pce"' will run the portmapping and pce tests.
90 # Additionnally, a different launcher command than 'nosetests --with-xunit' can be
91 # used by exporting the variable LAUNCHER. For example 'export LAUNCHER="python3"'
92 # which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
93 # files attributes.
94
95 [testenv:build_karaf_tests221]
96 depends = buildcontroller
97 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
98 whitelist_externals = launch_tests.sh
99 passenv = LAUNCHER USE_LIGHTY
100 setenv =
101 #    USE_LIGHTY=True
102     USE_ODL_ALT_KARAF_ENV=./karaf221.env
103     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
104 commands =
105   ./build_karaf_for_tests.sh
106
107 [testenv:tests221]
108 depends = buildcontroller,build_karaf_tests221,sims221,tests71
109 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
110 whitelist_externals = launch_tests.sh
111 passenv = LAUNCHER USE_LIGHTY
112 setenv =
113 #    USE_LIGHTY=True
114     USE_ODL_ALT_KARAF_ENV=./karaf221.env
115     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
116 commands =
117   ./launch_tests.sh 2.2.1 {posargs:}
118
119 [testenv:build_karaf_tests71]
120 depends = buildcontroller
121 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
122 whitelist_externals = launch_tests.sh
123 passenv = LAUNCHER USE_LIGHTY
124 setenv =
125 #    USE_LIGHTY=True
126     USE_ODL_ALT_KARAF_ENV=./karaf71.env
127     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
128 commands =
129   ./build_karaf_for_tests.sh
130
131 [testenv:tests71]
132 depends = buildcontroller,build_karaf_tests71,sims71
133 whitelist_externals = launch_tests.sh
134 passenv = LAUNCHER USE_LIGHTY
135 setenv =
136 #    USE_LIGHTY=True
137     USE_ODL_ALT_KARAF_ENV=./karaf71.env
138     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
139 commands =
140   ./launch_tests.sh 7.1 {posargs:}
141
142 [testenv:build_karaf_tests_hybrid]
143 depends = buildcontroller
144 # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
145 whitelist_externals = launch_tests.sh
146 passenv = LAUNCHER USE_LIGHTY
147 setenv =
148 #    USE_LIGHTY=True
149     USE_ODL_ALT_KARAF_ENV=./karaf121.env
150     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
151 commands =
152   ./build_karaf_for_tests.sh
153
154 [testenv:tests_hybrid]
155 depends = buildcontroller,sims121,sims221,sims71,tests121,tests221,tests71
156 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
157 whitelist_externals = launch_tests.sh
158 passenv = LAUNCHER USE_LIGHTY
159 setenv =
160 #    USE_LIGHTY=True
161     USE_ODL_ALT_KARAF_ENV=./karaf121.env
162     USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
163 commands =
164 #  nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py
165   ./launch_tests.sh hybrid {posargs:}
166
167 [testenv:gnpy]
168 depends = buildcontroller
169 whitelist_externals = launch_tests.sh
170                       dockercmd.sh
171 passenv = LAUNCHER USE_LIGHTY
172 commands =
173   #sudo docker pull atriki/gnpyrest:v1.2
174   ./dockercmd.sh run -d -p 8008:5000 --name gnpy_tpce_rest1 atriki/gnpyrest:v1.2
175   ./launch_tests.sh with_docker gnpy
176   ./dockercmd.sh container rm -f gnpy_tpce_rest1
177
178 [testenv:nbinotifications]
179 depends = buildcontroller,sims221
180 whitelist_externals = launch_tests.sh
181                       dockercmd.sh
182 passenv = LAUNCHER USE_LIGHTY
183 commands =
184   ./dockercmd.sh run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --name tpce_kafka1 teivah/kafka:2.0.0
185   ./launch_tests.sh with_docker nbinotifications
186   ./dockercmd.sh container rm -f tpce_kafka1
187
188 [testenv:docs]
189 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
190 basepython = python3
191 deps = -rdocs/requirements.txt
192 commands =
193     sphinx-build -q -W -b html -n -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/html
194
195 [testenv:docs-linkcheck]
196 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
197 basepython = python3
198 deps = -rdocs/requirements.txt
199 commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/linkcheck
200
201 [testenv:checkbashisms]
202 deps =
203 whitelist_externals = sh
204                       checkbashisms
205                       sudo
206                       find
207 commands =
208     sh -c 'command checkbashisms>/dev/null || sudo yum install devscripts-minimal || (echo "checkbashisms command not found - please install it (e.g. sudo apt-get install devscripts | yum install devscripts-minimal )" >&2 && exit 1)'
209     find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f  \{\} +
210
211 [testenv:spelling]
212 basepython = python3
213 deps =
214     -rdocs/requirements.txt
215     sphinxcontrib-spelling
216     PyEnchant
217 commands = sphinx-build -b spelling  -d {envtmpdir}/doctrees ../docs/ {toxinidir}/docs/_build/spelling
218
219 [testenv:autopep8]
220 basepython = python3
221 deps = autopep8
222 commands =
223     autopep8 --max-line-length 120 --in-place --recursive transportpce_tests/
224
225 [testenv:pylint]
226 basepython = python3
227 deps = pylint
228 whitelist_externals = find
229 commands =
230     find transportpce_tests/ -name *.py -exec pylint --max-line-length=120 --disable=missing-docstring --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  \{\} +
231
232 [testenv:pyang]
233 basepython = python3
234 deps = pyang
235 whitelist_externals = find
236 commands =
237     pyang --version
238     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/ \{\} +
239 #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/ \{\} +
240
241 [testenv:pyangformat]
242 basepython = python3
243 deps = pyang
244 whitelist_externals = sh
245 commands =
246     pyang --version
247     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'
248
249 [testenv:pre-commit-install]
250 basepython = python3
251 deps = pre-commit
252 commands =
253     pre-commit install
254     pre-commit install --hook-type commit-msg
255
256 [testenv:pre-commit-uninstall]
257 basepython = python3
258 deps = pre-commit
259 commands =
260     pre-commit uninstall
261     pre-commit uninstall --hook-type commit-msg
262
263 [testenv:pre-commit-autoupdate]
264 basepython = python3
265 deps = pre-commit
266 commands =
267     pre-commit autoupdate
268
269 [testenv:pre-commit]
270 basepython = python3
271 deps = pre-commit
272 passenv = HOME
273 commands =
274     pre-commit run --all-files --show-diff-on-failure
275     pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
276     # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
277     # Its default arguments --passed and --msg-filename are different from CI recommandations.
278     # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file.
279     # A dedicated gitlint profile for CI is proposed below. Also to behave fine locally, this profile must have access
280     # to the HOME variable so that Gitlint can retrieve Git user settings.
281
282 [testenv:gitlint]
283 basepython = python3
284 deps = gitlint
285 commands =
286     gitlint
287