blob: a0fef5ad0db33c518c312594b8d70ad632018f9e [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
beierlma0911d32021-02-22 14:30:35 -050016
tiernoc94c3df2018-02-09 15:38:54 +010017[tox]
beierlma0911d32021-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
beierlma0911d32021-02-22 14:30:35 -050026setenv = VIRTUAL_ENV={envdir}
27 PYTHONDONTWRITEBYTECODE = 1
28deps = -r{toxinidir}/requirements.txt
tiernoc94c3df2018-02-09 15:38:54 +010029
beierlma0911d32021-02-22 14:30:35 -050030#######################################################################################
31[testenv:black]
32deps = black
33skip_install = true
34commands =
35 - black --check --diff osm_nbi/
36
37
38#######################################################################################
garciadeblasf417d522020-02-19 18:11:52 +010039[testenv:cover]
beierlma0911d32021-02-22 14:30:35 -050040deps = {[testenv]deps}
41 -r{toxinidir}/requirements-dev.txt
42 -r{toxinidir}/requirements-test.txt
garciadeblasf417d522020-02-19 18:11:52 +010043commands =
beierlma0911d32021-02-22 14:30:35 -050044 sh -c 'rm -f nosetests.xml'
45 coverage erase
46 nose2 -C --coverage osm_nbi -s osm_nbi/tests
47 coverage report --omit='*tests*'
48 coverage html -d ./cover --omit='*tests*'
49 coverage xml -o coverage.xml --omit=*tests*
50whitelist_externals = sh
garciadeblasf417d522020-02-19 18:11:52 +010051
beierlma0911d32021-02-22 14:30:35 -050052
53#######################################################################################
tiernoc94c3df2018-02-09 15:38:54 +010054[testenv:flake8]
beierlma0911d32021-02-22 14:30:35 -050055deps = flake8
garciadeblasf417d522020-02-19 18:11:52 +010056commands =
beierlma0911d32021-02-22 14:30:35 -050057 - flake8 osm_nbi/ setup.py
tiernoc94c3df2018-02-09 15:38:54 +010058
tierno0c01ffa2018-11-19 14:39:33 +010059
beierlma0911d32021-02-22 14:30:35 -050060#######################################################################################
61[testenv:pylint]
62deps = {[testenv]deps}
63 -r{toxinidir}/requirements-dev.txt
64 -r{toxinidir}/requirements-test.txt
65 pylint
66commands =
67 - pylint -E osm_nbi
tierno1bfe4e22019-09-02 16:03:25 +000068
beierlma0911d32021-02-22 14:30:35 -050069
70#######################################################################################
71[testenv:safety]
72setenv =
73 LC_ALL=C.UTF-8
74 LANG=C.UTF-8
75deps = {[testenv]deps}
76 safety
77commands =
78 - safety check --full-report
79
80
81#######################################################################################
82[testenv:pip-compile]
83deps = pip-tools==5.5.0
84commands =
85 - sh -c 'for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
86 out=`echo $file | sed "s/.in/.txt/"` ; \
87 head -16 tox.ini >> $out ;\
88 done'
89whitelist_externals = sh
90
91
92#######################################################################################
93[testenv:dist]
94deps = {[testenv]deps}
95 -r{toxinidir}/requirements-dist.txt
96
97# In the commands, we copy the requirements.txt to be presented as a source file (.py)
98# so it gets included in the .deb package for others to consume
99commands =
100 sh -c 'cp requirements.txt osm_nbi/requirements.txt'
101 python3 setup.py --command-packages=stdeb.command sdist_dsc
102 sh -c 'cd deb_dist/osm-nbi*/ && dpkg-buildpackage -rfakeroot -uc -us'
103 sh -c 'rm osm_nbi/requirements.txt'
104whitelist_externals = sh
105
106#######################################################################################
107[flake8]
108ignore =
109 W291,
110 W293,
111 W503,
112 E123,
113 E125,
114 E226,
115 E241
116exclude =
117 .git,
118 __pycache__,
119 .tox,
120 test_mznmodels.py
121max-line-length = 120
122show-source = True
123builtins = _