blob: 156492afc1a04a4b506eaf931b2020dbc48c141b [file] [log] [blame]
beierlmb483b922021-02-11 14:57:14 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
tierno87858ca2018-10-08 16:30:15 +02003#
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.
beierlmb483b922021-02-11 14:57:14 -050016#######################################################################################
tierno87858ca2018-10-08 16:30:15 +020017
tierno5c012612018-04-19 16:01:59 +020018[tox]
beierlmb483b922021-02-11 14:57:14 -050019envlist = black, cover, flake8, pylint, safety
20
21[tox:jenkins]
22toxworkdir = /tmp/.tox
garciadeblasa8747992020-07-03 10:59:34 +000023
24[testenv]
25usedevelop = True
garciadeblas3099aef2025-10-01 10:56:51 +020026basepython = python3.13
beierlmb483b922021-02-11 14:57:14 -050027setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
garciadeblas409397d2024-04-09 17:33:37 +020030parallel_show_output = true
garciadeblasa8747992020-07-03 10:59:34 +000031
beierlmb483b922021-02-11 14:57:14 -050032#######################################################################################
33[testenv:black]
garciadeblasa690b2c2024-01-29 18:07:23 +010034deps = black==23.12.1
beierlmb483b922021-02-11 14:57:14 -050035skip_install = true
garciadeblasa8747992020-07-03 10:59:34 +000036commands =
garciadeblas3099aef2025-10-01 10:56:51 +020037 black --exclude "_version\.py$" --check --diff src/ tests/
tierno5c012612018-04-19 16:01:59 +020038
beierlmb483b922021-02-11 14:57:14 -050039#######################################################################################
40[testenv:cover]
41deps = {[testenv]deps}
42 -r{toxinidir}/requirements-test.txt
43commands =
44 sh -c 'rm -f nosetests.xml'
45 coverage erase
garciadeblas3099aef2025-10-01 10:56:51 +020046 nose2 -C --coverage src -s tests
beierlmb483b922021-02-11 14:57:14 -050047 coverage report --omit='*tests*'
48 coverage html -d ./cover --omit='*tests*'
49 coverage xml -o coverage.xml --omit=*tests*
Gulsum Aticia06b8542023-05-09 13:42:13 +030050allowlist_externals = sh
tierno5c012612018-04-19 16:01:59 +020051
beierlmb483b922021-02-11 14:57:14 -050052#######################################################################################
tierno5c012612018-04-19 16:01:59 +020053[testenv:flake8]
aticig3dd0db62022-03-04 19:35:45 +030054deps =
Mark Beierleef2eb12023-08-11 14:28:45 +000055 flake8==6.0.0
aticig3dd0db62022-03-04 19:35:45 +030056 flake8-import-order
tierno5c012612018-04-19 16:01:59 +020057commands =
garciadeblas3099aef2025-10-01 10:56:51 +020058 flake8 src/ tests/
tierno5c012612018-04-19 16:01:59 +020059
beierlmb483b922021-02-11 14:57:14 -050060#######################################################################################
61[testenv:pylint]
62deps = {[testenv]deps}
63 -r{toxinidir}/requirements-test.txt
64 pylint
65commands =
garciadeblas3099aef2025-10-01 10:56:51 +020066 pylint -E src
tierno136f2952018-10-19 13:01:03 +020067
beierlmb483b922021-02-11 14:57:14 -050068#######################################################################################
69[testenv:safety]
70setenv =
71 LC_ALL=C.UTF-8
72 LANG=C.UTF-8
73deps = {[testenv]deps}
74 safety
75commands =
76 - safety check --full-report
garciadeblasa8747992020-07-03 10:59:34 +000077
beierlmb483b922021-02-11 14:57:14 -050078#######################################################################################
79[testenv:pip-compile]
garciadeblas8aee4c52023-09-06 11:22:38 +020080deps = pip-tools==6.13.0
beierlmb0291ff2022-01-13 11:37:31 -050081skip_install = true
Gulsum Aticia06b8542023-05-09 13:42:13 +030082allowlist_externals = bash
beierlmb0291ff2022-01-13 11:37:31 -050083 [
beierlmb483b922021-02-11 14:57:14 -050084commands =
beierlmb0291ff2022-01-13 11:37:31 -050085 - bash -c "for file in requirements*.in ; do \
86 UNSAFE="" ; \
87 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
garciadeblas8aee4c52023-09-06 11:22:38 +020088 pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\
beierlmb0291ff2022-01-13 11:37:31 -050089 out=`echo $file | sed 's/.in/.txt/'` ; \
90 sed -i -e '1 e head -16 tox.ini' $out ;\
91 done"
beierlmb483b922021-02-11 14:57:14 -050092
93#######################################################################################
aticig3dd0db62022-03-04 19:35:45 +030094[testenv:release_notes]
95deps = reno
96skip_install = true
Gulsum Aticia06b8542023-05-09 13:42:13 +030097allowlist_externals = bash
aticig3dd0db62022-03-04 19:35:45 +030098commands =
99 reno new {posargs:new_feature}
100 bash -c "sed -i -e '1 e head -16 tox.ini' releasenotes/notes/{posargs:new_feature}*.yaml"
101
102#######################################################################################
beierlmb483b922021-02-11 14:57:14 -0500103[flake8]
104ignore =
105 W291,
106 W293,
garciadeblas2644b762021-03-24 09:21:01 +0100107 W503,
beierlmb483b922021-02-11 14:57:14 -0500108 E123,
109 E125,
garciadeblas2644b762021-03-24 09:21:01 +0100110 E203,
beierlmb483b922021-02-11 14:57:14 -0500111 E226,
112 E241
113exclude =
114 .git,
115 __pycache__,
116 .tox,
117max-line-length = 120
118show-source = True
119builtins = _
aticig3dd0db62022-03-04 19:35:45 +0300120import-order-style = google
garciadeblas3099aef2025-10-01 10:56:51 +0200121