blob: 630fbca79d886cf2bc14fd2fa1cb5c29a31903f0 [file] [log] [blame]
beierlmacf83f82021-03-17 08:11:23 -04001#######################################################################################
2# Copyright ETSI Contributors and Others.
tiernob3cda2e2018-10-30 17:26:59 +00003#
4# 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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# 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.
beierlmacf83f82021-03-17 08:11:23 -040016#######################################################################################
tiernob3cda2e2018-10-30 17:26:59 +000017
tiernoc0e42e22018-05-11 11:36:10 +020018[tox]
beierlmacf83f82021-03-17 08:11:23 -040019envlist = black, cover, flake8, pylint, safety
20
21[tox:jenkins]
22toxworkdir = /tmp/.tox
tiernoc0e42e22018-05-11 11:36:10 +020023
24[testenv]
garciadeblase6d17e62020-07-03 10:40:56 +000025usedevelop = True
tiernob3cda2e2018-10-30 17:26:59 +000026basepython = python3
beierlmacf83f82021-03-17 08:11:23 -040027setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
garciadeblas92aa6272020-02-19 17:40:44 +010030
beierlmacf83f82021-03-17 08:11:23 -040031#######################################################################################
32[testenv:black]
33deps = black
34skip_install = true
garciadeblas92aa6272020-02-19 17:40:44 +010035commands =
beierlmacf83f82021-03-17 08:11:23 -040036 - black --check --diff osm_lcm/
tiernoc0e42e22018-05-11 11:36:10 +020037
beierlmacf83f82021-03-17 08:11:23 -040038
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_lcm
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#######################################################################################
tiernoc0e42e22018-05-11 11:36:10 +020055[testenv:flake8]
beierlmacf83f82021-03-17 08:11:23 -040056deps = flake8
57commands =
58 flake8 osm_lcm/ setup.py
tiernoc0e42e22018-05-11 11:36:10 +020059
tiernob3cda2e2018-10-30 17:26:59 +000060
beierlmacf83f82021-03-17 08:11:23 -040061#######################################################################################
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_lcm
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_lcm/requirements.txt'
102 python3 setup.py --command-packages=stdeb.command sdist_dsc
103 sh -c 'cd deb_dist/osm-lcm*/ && dpkg-buildpackage -rfakeroot -uc -us'
104 sh -c 'rm osm_lcm/requirements.txt'
105whitelist_externals = sh
106
107#######################################################################################
108[flake8]
109ignore =
110 W291,
111 W293,
112 W503,
113 E123,
114 E125,
115 E226,
116 E241,
117# Temporary until code can be reformatted
118 E121,
119 E122,
120 E203,
121 E303,
122 E501
123 W504
124exclude =
125 .git,
126 __pycache__,
127 .tox,
128max-line-length = 120
129show-source = True
130builtins = _