Reformat files according to new black validation
[osm/NG-SA.git] / tox.ini
1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
17
18 [tox]
19 envlist = black, flake8
20
21 [tox:jenkins]
22 toxworkdir = /tmp/.tox
23 setenv = XDG_CACHE_HOME=/tmp/.cache
24
25 [testenv]
26 usedevelop = True
27 basepython = python3
28 setenv = VIRTUAL_ENV={envdir}
29 PYTHONDONTWRITEBYTECODE = 1
30 deps = -r{toxinidir}/requirements.txt
31 parallel_show_output = true
32
33
34 #######################################################################################
35 [testenv:black]
36 deps = black
37 skip_install = true
38 commands =
39 black --check --diff src
40
41
42 #######################################################################################
43 [testenv:cover]
44 deps = {[testenv]deps}
45 -r{toxinidir}/requirements-dev.txt
46 -r{toxinidir}/requirements-test.txt
47 whitelist_externals = sh
48 commands =
49 sh -c 'rm -f nosetests.xml'
50 coverage erase
51 nose2 -C --coverage src -s src
52 sh -c 'mv .coverage .coverage_mon'
53 coverage report --omit='*tests*'
54 coverage html -d ./cover --omit='*tests*'
55 coverage xml -o coverage.xml --omit='*tests*'
56
57
58 #######################################################################################
59 [testenv:flake8]
60 deps = flake8==5.0.4
61 flake8-import-order
62 skip_install = true
63 commands =
64 flake8 src/
65
66
67 #######################################################################################
68 [testenv:pylint]
69 deps = {[testenv]deps}
70 -r{toxinidir}/requirements-dev.txt
71 -r{toxinidir}/requirements-test.txt
72 pylint
73 skip_install = true
74 commands =
75 pylint -E src
76
77
78 #######################################################################################
79 [testenv:safety]
80 setenv =
81 LC_ALL=C.UTF-8
82 LANG=C.UTF-8
83 deps = {[testenv]deps}
84 safety
85 commands =
86 - safety check --full-report
87
88
89 #######################################################################################
90 [testenv:pip-compile]
91 deps = pip-tools==6.6.2
92 skip_install = true
93 whitelist_externals =
94 bash
95 [
96 commands =
97 bash -c "for file in requirements*.in ; do \
98 UNSAFE="" ; \
99 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
100 pip-compile -rU --no-header $UNSAFE $file ;\
101 out=`echo $file | sed 's/.in/.txt/'` ; \
102 sed -i -e '1 e head -16 tox.ini' $out ;\
103 done"
104
105
106 #######################################################################################
107 [testenv:dist]
108 deps = {[testenv]deps}
109 -r{toxinidir}/requirements-dist.txt
110
111 # In the commands, we copy the requirements.txt to be presented as a source file (.py)
112 # so it gets included in the .deb package for others to consume
113 commands =
114 sh -c 'cp requirements.txt src/osm_ngsa/requirements.txt'
115 sh -c 'cp README.rst src/osm_ngsa/README.rst'
116 python3 setup.py --command-packages=stdeb.command sdist_dsc
117 sh -c 'cd deb_dist/osm-ngsa*/ && dpkg-buildpackage -rfakeroot -uc -us'
118 sh -c 'rm src/osm_ngsa/requirements.txt'
119 sh -c 'rm src/osm_ngsa/README.rst'
120 whitelist_externals = sh
121
122
123 #######################################################################################
124 [flake8]
125 ignore =
126 W291,
127 W293,
128 W503,
129 W605,
130 E123,
131 E125,
132 E203,
133 E226,
134 E241,
135 E501,
136 exclude =
137 .git,
138 __pycache__,
139 .tox,
140 max-line-length = 120
141 show-source = True
142 builtins = _
143 import-order-style = google