1 # Copyright 2018 Telefonica S.A.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 envlist = black, cover, flake8, pylint, safety
21 toxworkdir = /tmp/.tox
25 basepython = python3.8
26 setenv = VIRTUAL_ENV={envdir}
27 PYTHONDONTWRITEBYTECODE = 1
28 deps = -r{toxinidir}/requirements.txt
30 #######################################################################################
35 - black
--check
--diff osm_nbi
/
36 - black
--check
--diff setup.py
39 #######################################################################################
41 deps = {[testenv]deps}
42 -r
{toxinidir
}/requirements
-dev.txt
43 -r
{toxinidir
}/requirements
-test.txt
45 sh
-c 'rm
-f nosetests.xml'
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*
51 whitelist_externals = sh
54 #######################################################################################
58 - flake8 osm_nbi
/ setup.py
61 #######################################################################################
63 deps = {[testenv]deps}
64 -r
{toxinidir
}/requirements
-dev.txt
65 -r
{toxinidir
}/requirements
-test.txt
71 #######################################################################################
76 deps = {[testenv]deps}
79 - safety check
--full
-report
82 #######################################################################################
84 deps = pip-tools==6.6.2
86 whitelist_externals = bash
89 - bash
-c
"for file in requirements*.in ; do \
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 ;\
98 #######################################################################################
100 deps = {[testenv]deps}
101 -r
{toxinidir
}/requirements
-dist.txt
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
106 sh
-c 'cp requirements.txt osm_nbi
/requirements.txt'
107 python3 setup.py --command-packages=stdeb.command sdist_dsc
108 sh
-c 'cd deb_dist
/osm
-nbi
*/ && dpkg
-buildpackage
-rfakeroot
-uc
-us'
109 sh
-c 'rm osm_nbi
/requirements.txt'
110 whitelist_externals = sh
112 #######################################################################################
128 max-line-length = 120