blob: 2fdac0f2843e550e3c08d1cef0d5ad6a9fc2dc52 [file] [log] [blame]
garciadeblas66834562022-11-10 14:07:04 +01001#######################################################################################
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]
19envlist = black, flake8
20
21[tox:jenkins]
22toxworkdir = /tmp/.tox
23setenv = XDG_CACHE_HOME=/tmp/.cache
24
25[testenv]
26usedevelop = True
27basepython = python3
28setenv = VIRTUAL_ENV={envdir}
29 PYTHONDONTWRITEBYTECODE = 1
30deps = -r{toxinidir}/requirements.txt
31parallel_show_output = true
32
33
34#######################################################################################
35[testenv:black]
36deps = black
37skip_install = true
38commands =
39 black --check --diff src
40
41
42#######################################################################################
43[testenv:cover]
44deps = {[testenv]deps}
45 -r{toxinidir}/requirements-dev.txt
46 -r{toxinidir}/requirements-test.txt
garciadeblas33715472023-03-31 21:45:46 +020047allowlist_externals = sh
garciadeblas66834562022-11-10 14:07:04 +010048commands =
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]
garciadeblas998ff732022-11-10 14:19:44 +010060deps = flake8==5.0.4
garciadeblas66834562022-11-10 14:07:04 +010061 flake8-import-order
62skip_install = true
63commands =
64 flake8 src/
65
66
67#######################################################################################
68[testenv:pylint]
69deps = {[testenv]deps}
70 -r{toxinidir}/requirements-dev.txt
71 -r{toxinidir}/requirements-test.txt
72 pylint
73skip_install = true
74commands =
75 pylint -E src
76
77
78#######################################################################################
79[testenv:safety]
80setenv =
81 LC_ALL=C.UTF-8
82 LANG=C.UTF-8
83deps = {[testenv]deps}
84 safety
85commands =
86 - safety check --full-report
87
88
89#######################################################################################
90[testenv:pip-compile]
91deps = pip-tools==6.6.2
92skip_install = true
garciadeblas33715472023-03-31 21:45:46 +020093allowlist_externals =
garciadeblas66834562022-11-10 14:07:04 +010094 bash
95 [
96commands =
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#######################################################################################
garciadeblas8d41d562022-11-24 14:42:35 +0100107[testenv:dist]
108deps = {[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
113commands =
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'
garciadeblas33715472023-03-31 21:45:46 +0200120allowlist_externals = sh
garciadeblas8d41d562022-11-24 14:42:35 +0100121
122
123#######################################################################################
garciadeblas66834562022-11-10 14:07:04 +0100124[flake8]
125ignore =
126 W291,
127 W293,
128 W503,
129 W605,
130 E123,
131 E125,
132 E203,
133 E226,
134 E241,
135 E501,
136exclude =
137 .git,
138 __pycache__,
139 .tox,
140max-line-length = 120
141show-source = True
142builtins = _
143import-order-style = google