| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 1 | ####################################################################################### |
| 2 | # Copyright ETSI Contributors and Others. |
| tierno | 87858ca | 2018-10-08 16:30:15 +0200 | [diff] [blame] | 3 | # |
| 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. |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 16 | ####################################################################################### |
| tierno | 87858ca | 2018-10-08 16:30:15 +0200 | [diff] [blame] | 17 | |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 18 | [tox] |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 19 | envlist = black, cover, flake8, pylint, safety |
| 20 | |
| 21 | [tox:jenkins] |
| 22 | toxworkdir = /tmp/.tox |
| garciadeblas | a874799 | 2020-07-03 10:59:34 +0000 | [diff] [blame] | 23 | |
| 24 | [testenv] |
| 25 | usedevelop = True |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 26 | basepython = python3.13 |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 27 | setenv = VIRTUAL_ENV={envdir} |
| 28 | PYTHONDONTWRITEBYTECODE = 1 |
| 29 | deps = -r{toxinidir}/requirements.txt |
| garciadeblas | 409397d | 2024-04-09 17:33:37 +0200 | [diff] [blame] | 30 | parallel_show_output = true |
| garciadeblas | a874799 | 2020-07-03 10:59:34 +0000 | [diff] [blame] | 31 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 32 | ####################################################################################### |
| 33 | [testenv:black] |
| garciadeblas | a690b2c | 2024-01-29 18:07:23 +0100 | [diff] [blame] | 34 | deps = black==23.12.1 |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 35 | skip_install = true |
| garciadeblas | a874799 | 2020-07-03 10:59:34 +0000 | [diff] [blame] | 36 | commands = |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 37 | black --exclude "_version\.py$" --check --diff src/ tests/ |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 38 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 39 | ####################################################################################### |
| 40 | [testenv:cover] |
| 41 | deps = {[testenv]deps} |
| 42 | -r{toxinidir}/requirements-test.txt |
| 43 | commands = |
| 44 | sh -c 'rm -f nosetests.xml' |
| 45 | coverage erase |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 46 | nose2 -C --coverage src -s tests |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 47 | coverage report --omit='*tests*' |
| 48 | coverage html -d ./cover --omit='*tests*' |
| 49 | coverage xml -o coverage.xml --omit=*tests* |
| Gulsum Atici | a06b854 | 2023-05-09 13:42:13 +0300 | [diff] [blame] | 50 | allowlist_externals = sh |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 51 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 52 | ####################################################################################### |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 53 | [testenv:flake8] |
| aticig | 3dd0db6 | 2022-03-04 19:35:45 +0300 | [diff] [blame] | 54 | deps = |
| Mark Beierl | eef2eb1 | 2023-08-11 14:28:45 +0000 | [diff] [blame] | 55 | flake8==6.0.0 |
| aticig | 3dd0db6 | 2022-03-04 19:35:45 +0300 | [diff] [blame] | 56 | flake8-import-order |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 57 | commands = |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 58 | flake8 src/ tests/ |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 59 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 60 | ####################################################################################### |
| 61 | [testenv:pylint] |
| 62 | deps = {[testenv]deps} |
| 63 | -r{toxinidir}/requirements-test.txt |
| 64 | pylint |
| 65 | commands = |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 66 | pylint -E src |
| tierno | 136f295 | 2018-10-19 13:01:03 +0200 | [diff] [blame] | 67 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 68 | ####################################################################################### |
| 69 | [testenv:safety] |
| 70 | setenv = |
| 71 | LC_ALL=C.UTF-8 |
| 72 | LANG=C.UTF-8 |
| 73 | deps = {[testenv]deps} |
| 74 | safety |
| 75 | commands = |
| 76 | - safety check --full-report |
| garciadeblas | a874799 | 2020-07-03 10:59:34 +0000 | [diff] [blame] | 77 | |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 78 | ####################################################################################### |
| 79 | [testenv:pip-compile] |
| garciadeblas | 8aee4c5 | 2023-09-06 11:22:38 +0200 | [diff] [blame] | 80 | deps = pip-tools==6.13.0 |
| beierlm | b0291ff | 2022-01-13 11:37:31 -0500 | [diff] [blame] | 81 | skip_install = true |
| Gulsum Atici | a06b854 | 2023-05-09 13:42:13 +0300 | [diff] [blame] | 82 | allowlist_externals = bash |
| beierlm | b0291ff | 2022-01-13 11:37:31 -0500 | [diff] [blame] | 83 | [ |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 84 | commands = |
| beierlm | b0291ff | 2022-01-13 11:37:31 -0500 | [diff] [blame] | 85 | - bash -c "for file in requirements*.in ; do \ |
| 86 | UNSAFE="" ; \ |
| 87 | if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \ |
| garciadeblas | 8aee4c5 | 2023-09-06 11:22:38 +0200 | [diff] [blame] | 88 | pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\ |
| beierlm | b0291ff | 2022-01-13 11:37:31 -0500 | [diff] [blame] | 89 | out=`echo $file | sed 's/.in/.txt/'` ; \ |
| 90 | sed -i -e '1 e head -16 tox.ini' $out ;\ |
| 91 | done" |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 92 | |
| 93 | ####################################################################################### |
| aticig | 3dd0db6 | 2022-03-04 19:35:45 +0300 | [diff] [blame] | 94 | [testenv:release_notes] |
| 95 | deps = reno |
| 96 | skip_install = true |
| Gulsum Atici | a06b854 | 2023-05-09 13:42:13 +0300 | [diff] [blame] | 97 | allowlist_externals = bash |
| aticig | 3dd0db6 | 2022-03-04 19:35:45 +0300 | [diff] [blame] | 98 | commands = |
| 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 | ####################################################################################### |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 103 | [flake8] |
| 104 | ignore = |
| 105 | W291, |
| 106 | W293, |
| garciadeblas | 2644b76 | 2021-03-24 09:21:01 +0100 | [diff] [blame] | 107 | W503, |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 108 | E123, |
| 109 | E125, |
| garciadeblas | 2644b76 | 2021-03-24 09:21:01 +0100 | [diff] [blame] | 110 | E203, |
| beierlm | b483b92 | 2021-02-11 14:57:14 -0500 | [diff] [blame] | 111 | E226, |
| 112 | E241 |
| 113 | exclude = |
| 114 | .git, |
| 115 | __pycache__, |
| 116 | .tox, |
| 117 | max-line-length = 120 |
| 118 | show-source = True |
| 119 | builtins = _ |
| aticig | 3dd0db6 | 2022-03-04 19:35:45 +0300 | [diff] [blame] | 120 | import-order-style = google |
| garciadeblas | 3099aef | 2025-10-01 10:56:51 +0200 | [diff] [blame] | 121 | |