blob: 98409d36e3aafb6dec73be0b0256fb9c60e677f6 [file] [log] [blame]
beierlm6e06e752021-02-16 16:52:29 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
magnussonl2b0e2d72020-02-04 10:52:46 +01003#
beierlm6e06e752021-02-16 16:52:29 -05004# 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
magnussonl2b0e2d72020-02-04 10:52:46 +01007#
beierlm6e06e752021-02-16 16:52:29 -05008# http://www.apache.org/licenses/LICENSE-2.0
magnussonl2b0e2d72020-02-04 10:52:46 +01009#
10# Unless required by applicable law or agreed to in writing, software
beierlm6e06e752021-02-16 16:52:29 -050011# 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
magnussonl2b0e2d72020-02-04 10:52:46 +010018[tox]
beierlm6e06e752021-02-16 16:52:29 -050019envlist = black, cover, flake8, pylint, safety
20
21[tox:jenkins]
22toxworkdir = /tmp/.tox
magnussonl2b0e2d72020-02-04 10:52:46 +010023
24[testenv]
beierlm6e06e752021-02-16 16:52:29 -050025usedevelop = True
Dario Faccin0d0e80f2023-05-24 16:58:47 +020026basepython = python3.10
beierlm6e06e752021-02-16 16:52:29 -050027setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
garciadeblas20fc3b72022-11-14 00:48:32 +010030parallel_show_output = true
magnussonl2b0e2d72020-02-04 10:52:46 +010031
beierlm6e06e752021-02-16 16:52:29 -050032#######################################################################################
33[testenv:black]
34deps = black
35skip_install = true
36commands =
garciadeblas20fc3b72022-11-14 00:48:32 +010037 black --check --diff osm_pla/
magnussonl2b0e2d72020-02-04 10:52:46 +010038
beierlm6e06e752021-02-16 16:52:29 -050039
40#######################################################################################
41[testenv:cover]
42deps = {[testenv]deps}
43 -r{toxinidir}/requirements-dev.txt
44 -r{toxinidir}/requirements-test.txt
45commands =
46 sh -c 'rm -f nosetests.xml'
47 coverage erase
48 nose2 -C --coverage osm_pla
49 coverage report --omit='*tests*'
50 coverage html -d ./cover --omit='*tests*'
51 coverage xml -o coverage.xml --omit=*tests*
Dario Faccin0d0e80f2023-05-24 16:58:47 +020052allowlist_externals = sh
beierlm6e06e752021-02-16 16:52:29 -050053
54
55#######################################################################################
magnussonl2b0e2d72020-02-04 10:52:46 +010056[testenv:flake8]
magnussonl2b0e2d72020-02-04 10:52:46 +010057deps = flake8
beierlm6e06e752021-02-16 16:52:29 -050058commands =
59 flake8 osm_pla/ setup.py
magnussonl2b0e2d72020-02-04 10:52:46 +010060
beierlm6e06e752021-02-16 16:52:29 -050061
62#######################################################################################
63[testenv:pylint]
64deps = {[testenv]deps}
65 -r{toxinidir}/requirements-dev.txt
66 -r{toxinidir}/requirements-test.txt
67 pylint
68commands =
69 pylint -E osm_pla
70
71
72#######################################################################################
73[testenv:safety]
74setenv =
75 LC_ALL=C.UTF-8
76 LANG=C.UTF-8
77deps = {[testenv]deps}
78 safety
79commands =
80 - safety check --full-report
81
82
83#######################################################################################
84[testenv:pip-compile]
beierlmd28e25b2022-06-24 13:49:51 -040085deps = pip-tools==6.6.2
beierlmc48a5e42022-01-13 13:12:46 -050086skip_install = true
Dario Faccin0d0e80f2023-05-24 16:58:47 +020087allowlist_externals = bash
beierlmc48a5e42022-01-13 13:12:46 -050088 [
beierlm6e06e752021-02-16 16:52:29 -050089commands =
beierlmc48a5e42022-01-13 13:12:46 -050090 - bash -c "for file in requirements*.in ; do \
91 UNSAFE="" ; \
92 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
93 pip-compile -rU --no-header $UNSAFE $file ;\
94 out=`echo $file | sed 's/.in/.txt/'` ; \
95 sed -i -e '1 e head -16 tox.ini' $out ;\
96 done"
beierlm6e06e752021-02-16 16:52:29 -050097
98
99#######################################################################################
100[testenv:dist]
101deps = {[testenv]deps}
102 -r{toxinidir}/requirements-dist.txt
103
104# In the commands, we copy the requirements.txt to be presented as a source file (.py)
105# so it gets included in the .deb package for others to consume
106commands =
107 sh -c 'cp requirements.txt osm_pla/requirements.txt'
108 python3 setup.py --command-packages=stdeb.command sdist_dsc
109 sh -c 'cd deb_dist/osm-pla*/ && dpkg-buildpackage -rfakeroot -uc -us'
110 sh -c 'rm osm_pla/requirements.txt'
Dario Faccin0d0e80f2023-05-24 16:58:47 +0200111allowlist_externals = sh
beierlm6e06e752021-02-16 16:52:29 -0500112
113#######################################################################################
114[flake8]
115ignore =
116 W291,
117 W293,
118 W503,
119 E123,
120 E125,
121 E226,
122 E241
123exclude =
124 .git,
125 __pycache__,
126 .tox,
127 test_mznmodels.py
128max-line-length = 120
129show-source = True
130builtins = _