blob: 5cb66e779778e150d42207f4aee1777aa16bce58 [file] [log] [blame]
tierno0c01ffa2018-11-19 14:39:33 +01001# Copyright 2018 Telefonica S.A.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
beierlm2663b792021-02-22 14:30:35 -050016
tiernoc94c3df2018-02-09 15:38:54 +010017[tox]
beierlm2663b792021-02-22 14:30:35 -050018envlist = black, cover, flake8, pylint, safety
19
20[tox:jenkins]
21toxworkdir = /tmp/.tox
tiernoc94c3df2018-02-09 15:38:54 +010022
23[testenv]
tierno1bfe4e22019-09-02 16:03:25 +000024usedevelop = True
tierno0c01ffa2018-11-19 14:39:33 +010025basepython = python3
beierlm2663b792021-02-22 14:30:35 -050026setenv = VIRTUAL_ENV={envdir}
27 PYTHONDONTWRITEBYTECODE = 1
28deps = -r{toxinidir}/requirements.txt
tiernoc94c3df2018-02-09 15:38:54 +010029
beierlm2663b792021-02-22 14:30:35 -050030#######################################################################################
31[testenv:black]
32deps = black
33skip_install = true
34commands =
35 - black --check --diff osm_nbi/
36 - black --check --diff setup.py
37
38
39#######################################################################################
garciadeblasf417d522020-02-19 18:11:52 +010040[testenv:cover]
beierlm2663b792021-02-22 14:30:35 -050041deps = {[testenv]deps}
42 -r{toxinidir}/requirements-dev.txt
43 -r{toxinidir}/requirements-test.txt
garciadeblasf417d522020-02-19 18:11:52 +010044commands =
beierlm2663b792021-02-22 14:30:35 -050045 sh -c 'rm -f nosetests.xml'
46 coverage erase
47 nose2 -C --coverage osm_nbi -s osm_nbi/tests
48 coverage report --omit='*tests*'
49 coverage html -d ./cover --omit='*tests*'
50 coverage xml -o coverage.xml --omit=*tests*
51whitelist_externals = sh
garciadeblasf417d522020-02-19 18:11:52 +010052
beierlm2663b792021-02-22 14:30:35 -050053
54#######################################################################################
tiernoc94c3df2018-02-09 15:38:54 +010055[testenv:flake8]
beierlm2663b792021-02-22 14:30:35 -050056deps = flake8
garciadeblasf417d522020-02-19 18:11:52 +010057commands =
beierlm2663b792021-02-22 14:30:35 -050058 - flake8 osm_nbi/ setup.py
tiernoc94c3df2018-02-09 15:38:54 +010059
tierno0c01ffa2018-11-19 14:39:33 +010060
beierlm2663b792021-02-22 14:30:35 -050061#######################################################################################
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_nbi
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]
84deps = pip-tools==5.5.0
85commands =
86 - sh -c 'for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
87 out=`echo $file | sed "s/.in/.txt/"` ; \
88 head -16 tox.ini >> $out ;\
89 done'
90whitelist_externals = sh
91
92
93#######################################################################################
94[testenv:dist]
95deps = {[testenv]deps}
96 -r{toxinidir}/requirements-dist.txt
97
98# In the commands, we copy the requirements.txt to be presented as a source file (.py)
99# so it gets included in the .deb package for others to consume
100commands =
101 sh -c 'cp requirements.txt osm_nbi/requirements.txt'
102 python3 setup.py --command-packages=stdeb.command sdist_dsc
103 sh -c 'cd deb_dist/osm-nbi*/ && dpkg-buildpackage -rfakeroot -uc -us'
104 sh -c 'rm osm_nbi/requirements.txt'
105whitelist_externals = sh
106
107#######################################################################################
108[flake8]
109ignore =
110 W291,
111 W293,
112 W503,
113 E123,
114 E125,
115 E226,
116 E241
117exclude =
118 .git,
119 __pycache__,
120 .tox,
121 test_mznmodels.py
122max-line-length = 120
123show-source = True
124builtins = _
tierno1bfe4e22019-09-02 16:03:25 +0000125