blob: d4f93f1a469c10fce58ccdc2f7e2e722051132f9 [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
beierlm6c35c542022-01-13 13:12:46 -050026basepython = python3.8
beierlm6e06e752021-02-16 16:52:29 -050027setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
magnussonl2b0e2d72020-02-04 10:52:46 +010030
beierlm6e06e752021-02-16 16:52:29 -050031#######################################################################################
32[testenv:black]
33deps = black
34skip_install = true
35commands =
36 - black --check --diff osm_pla/
magnussonl2b0e2d72020-02-04 10:52:46 +010037
beierlm6e06e752021-02-16 16:52:29 -050038
39#######################################################################################
40[testenv:cover]
41deps = {[testenv]deps}
42 -r{toxinidir}/requirements-dev.txt
43 -r{toxinidir}/requirements-test.txt
44commands =
45 sh -c 'rm -f nosetests.xml'
46 coverage erase
47 nose2 -C --coverage osm_pla
48 coverage report --omit='*tests*'
49 coverage html -d ./cover --omit='*tests*'
50 coverage xml -o coverage.xml --omit=*tests*
51whitelist_externals = sh
52
53
54#######################################################################################
magnussonl2b0e2d72020-02-04 10:52:46 +010055[testenv:flake8]
magnussonl2b0e2d72020-02-04 10:52:46 +010056deps = flake8
beierlm6e06e752021-02-16 16:52:29 -050057commands =
58 flake8 osm_pla/ setup.py
magnussonl2b0e2d72020-02-04 10:52:46 +010059
beierlm6e06e752021-02-16 16:52:29 -050060
61#######################################################################################
62[testenv:pylint]
63deps = {[testenv]deps}
64 -r{toxinidir}/requirements-dev.txt
65 -r{toxinidir}/requirements-test.txt
66 pylint
67commands =
68 pylint -E osm_pla
69
70
71#######################################################################################
72[testenv:safety]
73setenv =
74 LC_ALL=C.UTF-8
75 LANG=C.UTF-8
76deps = {[testenv]deps}
77 safety
78commands =
79 - safety check --full-report
80
81
82#######################################################################################
83[testenv:pip-compile]
beierlm6c35c542022-01-13 13:12:46 -050084deps = pip-tools==6.4.0
85skip_install = true
86whitelist_externals = bash
87 [
beierlm6e06e752021-02-16 16:52:29 -050088commands =
beierlm6c35c542022-01-13 13:12:46 -050089 - bash -c "for file in requirements*.in ; do \
90 UNSAFE="" ; \
91 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
92 pip-compile -rU --no-header $UNSAFE $file ;\
93 out=`echo $file | sed 's/.in/.txt/'` ; \
94 sed -i -e '1 e head -16 tox.ini' $out ;\
95 done"
beierlm6e06e752021-02-16 16:52:29 -050096
97
98#######################################################################################
99[testenv:dist]
100deps = {[testenv]deps}
101 -r{toxinidir}/requirements-dist.txt
102
103# In the commands, we copy the requirements.txt to be presented as a source file (.py)
104# so it gets included in the .deb package for others to consume
105commands =
106 sh -c 'cp requirements.txt osm_pla/requirements.txt'
107 python3 setup.py --command-packages=stdeb.command sdist_dsc
108 sh -c 'cd deb_dist/osm-pla*/ && dpkg-buildpackage -rfakeroot -uc -us'
109 sh -c 'rm osm_pla/requirements.txt'
110whitelist_externals = sh
111
112#######################################################################################
113[flake8]
114ignore =
115 W291,
116 W293,
117 W503,
118 E123,
119 E125,
120 E226,
121 E241
122exclude =
123 .git,
124 __pycache__,
125 .tox,
126 test_mznmodels.py
127max-line-length = 120
128show-source = True
129builtins = _