blob: 0792929057a63b26c5645b9504fdaf15373f8957 [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
Daniel Arndt29cb2572023-07-05 14:14:09 -030018[isort]
19profile = "black"
20
tiernoc0e42e22018-05-11 11:36:10 +020021[tox]
beierlmacf83f82021-03-17 08:11:23 -040022envlist = black, cover, flake8, pylint, safety
23
24[tox:jenkins]
25toxworkdir = /tmp/.tox
tiernoc0e42e22018-05-11 11:36:10 +020026
27[testenv]
garciadeblase6d17e62020-07-03 10:40:56 +000028usedevelop = True
Dario Faccin1df4ede2023-06-01 10:15:34 +020029basepython = python3.10
beierlmacf83f82021-03-17 08:11:23 -040030setenv = VIRTUAL_ENV={envdir}
31 PYTHONDONTWRITEBYTECODE = 1
32deps = -r{toxinidir}/requirements.txt
garciadeblasfb1e25f2022-11-18 14:36:22 +010033parallel_show_output = true
garciadeblas92aa6272020-02-19 17:40:44 +010034
beierlmacf83f82021-03-17 08:11:23 -040035#######################################################################################
36[testenv:black]
37deps = black
38skip_install = true
garciadeblas92aa6272020-02-19 17:40:44 +010039commands =
preethika.p28b0bf82022-09-23 07:36:28 +000040 black --check --diff osm_lcm/
41 black --check --diff setup.py
tiernoc0e42e22018-05-11 11:36:10 +020042
beierlmacf83f82021-03-17 08:11:23 -040043
44#######################################################################################
45[testenv:cover]
46deps = {[testenv]deps}
47 -r{toxinidir}/requirements-dev.txt
48 -r{toxinidir}/requirements-test.txt
49commands =
50 sh -c 'rm -f nosetests.xml'
51 coverage erase
52 nose2 -C --coverage osm_lcm
53 coverage report --omit='*tests*'
54 coverage html -d ./cover --omit='*tests*'
55 coverage xml -o coverage.xml --omit=*tests*
Dario Faccin1df4ede2023-06-01 10:15:34 +020056allowlist_externals = sh
beierlmacf83f82021-03-17 08:11:23 -040057
58
59#######################################################################################
tiernoc0e42e22018-05-11 11:36:10 +020060[testenv:flake8]
beierlmacf83f82021-03-17 08:11:23 -040061deps = flake8
62commands =
63 flake8 osm_lcm/ setup.py
tiernoc0e42e22018-05-11 11:36:10 +020064
tiernob3cda2e2018-10-30 17:26:59 +000065
beierlmacf83f82021-03-17 08:11:23 -040066#######################################################################################
67[testenv:pylint]
68deps = {[testenv]deps}
69 -r{toxinidir}/requirements-dev.txt
70 -r{toxinidir}/requirements-test.txt
71 pylint
72commands =
Dario Faccin1df4ede2023-06-01 10:15:34 +020073 pylint -E osm_lcm --extension-pkg-allow-list=pydantic --disable=E1101 # issue with pydantic (https://github.com/pydantic/pydantic/issues/1961)
beierlmacf83f82021-03-17 08:11:23 -040074
75
76#######################################################################################
77[testenv:safety]
78setenv =
79 LC_ALL=C.UTF-8
80 LANG=C.UTF-8
81deps = {[testenv]deps}
82 safety
83commands =
84 - safety check --full-report
85
86
87#######################################################################################
88[testenv:pip-compile]
beierlmef921322022-06-24 21:17:53 -040089deps = pip-tools==6.6.2
beierlmd213eba2022-01-18 08:52:27 -050090skip_install = true
Dario Faccin1df4ede2023-06-01 10:15:34 +020091allowlist_externals = bash
beierlmd213eba2022-01-18 08:52:27 -050092 [
beierlmacf83f82021-03-17 08:11:23 -040093commands =
beierlmd213eba2022-01-18 08:52:27 -050094 - bash -c "for file in requirements*.in ; do \
95 UNSAFE="" ; \
96 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
97 pip-compile -rU --no-header $UNSAFE $file ;\
98 out=`echo $file | sed 's/.in/.txt/'` ; \
99 sed -i -e '1 e head -16 tox.ini' $out ;\
100 done"
beierlmacf83f82021-03-17 08:11:23 -0400101
102
103#######################################################################################
104[testenv:dist]
105deps = {[testenv]deps}
106 -r{toxinidir}/requirements-dist.txt
107
108# In the commands, we copy the requirements.txt to be presented as a source file (.py)
109# so it gets included in the .deb package for others to consume
110commands =
111 sh -c 'cp requirements.txt osm_lcm/requirements.txt'
112 python3 setup.py --command-packages=stdeb.command sdist_dsc
113 sh -c 'cd deb_dist/osm-lcm*/ && dpkg-buildpackage -rfakeroot -uc -us'
114 sh -c 'rm osm_lcm/requirements.txt'
Dario Faccin1df4ede2023-06-01 10:15:34 +0200115allowlist_externals = sh
beierlmacf83f82021-03-17 08:11:23 -0400116
117#######################################################################################
118[flake8]
119ignore =
120 W291,
121 W293,
122 W503,
123 E123,
124 E125,
125 E226,
126 E241,
127# Temporary until code can be reformatted
128 E121,
129 E122,
130 E203,
131 E303,
132 E501
133 W504
134exclude =
135 .git,
136 __pycache__,
137 .tox,
138max-line-length = 120
139show-source = True
140builtins = _