| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 1 | ####################################################################################### |
| 2 | # Copyright ETSI Contributors and Others. |
| 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. |
| 16 | ####################################################################################### |
| 17 | |
| 18 | [tox] |
| garciadeblas | 02f71cd | 2023-05-23 21:57:36 +0200 | [diff] [blame] | 19 | envlist = black, flake8, pylint, pylint-webhook |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 20 | |
| 21 | [tox:jenkins] |
| 22 | toxworkdir = /tmp/.tox |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 23 | |
| 24 | [testenv] |
| 25 | usedevelop = True |
| garciadeblas | 4e36505 | 2023-03-23 13:25:27 +0100 | [diff] [blame] | 26 | basepython = python3.10 |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 27 | setenv = VIRTUAL_ENV={envdir} |
| 28 | PYTHONDONTWRITEBYTECODE = 1 |
| 29 | deps = -r{toxinidir}/requirements.txt |
| 30 | parallel_show_output = true |
| 31 | |
| 32 | |
| 33 | ####################################################################################### |
| 34 | [testenv:black] |
| garciadeblas | 83b03b1 | 2026-01-20 12:40:18 +0100 | [diff] [blame] | 35 | deps = black==25.12.0 |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 36 | skip_install = true |
| 37 | commands = |
| garciadeblas | d067157 | 2023-03-27 14:22:09 +0200 | [diff] [blame] | 38 | black --check --diff src setup.py |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 39 | black --check --diff osm_webhook_translator |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 40 | |
| 41 | |
| 42 | ####################################################################################### |
| 43 | [testenv:cover] |
| 44 | deps = {[testenv]deps} |
| 45 | -r{toxinidir}/requirements-dev.txt |
| 46 | -r{toxinidir}/requirements-test.txt |
| garciadeblas | 239971d | 2023-03-23 11:46:36 +0100 | [diff] [blame] | 47 | allowlist_externals = sh |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 48 | commands = |
| 49 | sh -c 'rm -f nosetests.xml' |
| 50 | coverage erase |
| 51 | nose2 -C --coverage src -s src |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 52 | sh -c 'mv .coverage .coverage_ngsa' |
| 53 | nose2 -C --coverage osm_webhook_translator -s osm_webhook_translator |
| 54 | sh -c 'mv .coverage .coverage_webhook_translator' |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 55 | coverage report --omit='*tests*' |
| 56 | coverage html -d ./cover --omit='*tests*' |
| 57 | coverage xml -o coverage.xml --omit='*tests*' |
| 58 | |
| 59 | |
| 60 | ####################################################################################### |
| 61 | [testenv:flake8] |
| garciadeblas | a41ebbf | 2024-08-22 19:13:28 +0200 | [diff] [blame] | 62 | deps = flake8==7.0.0 |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 63 | flake8-import-order |
| garciadeblas | 1c33b06 | 2025-02-26 10:37:52 +0100 | [diff] [blame] | 64 | setuptools>=61 |
| 65 | setuptools_scm==8.2.0 |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 66 | commands = |
| garciadeblas | d067157 | 2023-03-27 14:22:09 +0200 | [diff] [blame] | 67 | flake8 src setup.py |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 68 | flake8 osm_webhook_translator |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 69 | |
| 70 | |
| 71 | ####################################################################################### |
| 72 | [testenv:pylint] |
| 73 | deps = {[testenv]deps} |
| 74 | -r{toxinidir}/requirements-dev.txt |
| 75 | -r{toxinidir}/requirements-test.txt |
| 76 | pylint |
| 77 | skip_install = true |
| 78 | commands = |
| garciadeblas | 879bfe6 | 2024-09-19 13:28:23 +0200 | [diff] [blame] | 79 | pylint -E src setup.py |
| garciadeblas | 02f71cd | 2023-05-23 21:57:36 +0200 | [diff] [blame] | 80 | |
| 81 | |
| 82 | [testenv:pylint-webhook] |
| 83 | changedir = {toxinidir}/osm_webhook_translator |
| 84 | deps = -r{toxinidir}/osm_webhook_translator/requirements.txt |
| 85 | pylint |
| 86 | skip_install = true |
| 87 | commands = |
| 88 | pylint -E src setup.py |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 89 | |
| 90 | |
| 91 | ####################################################################################### |
| 92 | [testenv:safety] |
| 93 | setenv = |
| 94 | LC_ALL=C.UTF-8 |
| 95 | LANG=C.UTF-8 |
| 96 | deps = {[testenv]deps} |
| 97 | safety |
| 98 | commands = |
| 99 | - safety check --full-report |
| 100 | |
| 101 | |
| 102 | ####################################################################################### |
| 103 | [testenv:pip-compile] |
| garciadeblas | cc9870f | 2023-05-10 11:03:41 +0200 | [diff] [blame] | 104 | deps = pip-tools==6.13.0 |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 105 | skip_install = true |
| garciadeblas | 239971d | 2023-03-23 11:46:36 +0100 | [diff] [blame] | 106 | allowlist_externals = |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 107 | bash |
| 108 | [ |
| 109 | commands = |
| 110 | bash -c "for file in requirements*.in ; do \ |
| 111 | UNSAFE="" ; \ |
| 112 | if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \ |
| garciadeblas | cc9870f | 2023-05-10 11:03:41 +0200 | [diff] [blame] | 113 | pip-compile -rU --resolver=backtracking --no-header $UNSAFE $file ;\ |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 114 | out=`echo $file | sed 's/.in/.txt/'` ; \ |
| 115 | sed -i -e '1 e head -16 tox.ini' $out ;\ |
| 116 | done" |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 117 | bash -c "for file in osm_webhook_translator/requirements*.in ; do \ |
| 118 | UNSAFE="" ; \ |
| 119 | if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \ |
| garciadeblas | 4e36505 | 2023-03-23 13:25:27 +0100 | [diff] [blame] | 120 | pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\ |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 121 | out=`echo $file | sed 's/.in/.txt/'` ; \ |
| 122 | sed -i -e '1 e head -16 tox.ini' $out ;\ |
| 123 | done" |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 124 | |
| 125 | |
| 126 | ####################################################################################### |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 127 | [testenv:dist_ng_sa] |
| garciadeblas | 8d41d56 | 2022-11-24 14:42:35 +0100 | [diff] [blame] | 128 | deps = {[testenv]deps} |
| 129 | -r{toxinidir}/requirements-dist.txt |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 130 | allowlist_externals = sh |
| garciadeblas | 8d41d56 | 2022-11-24 14:42:35 +0100 | [diff] [blame] | 131 | commands = |
| 132 | sh -c 'cp requirements.txt src/osm_ngsa/requirements.txt' |
| 133 | sh -c 'cp README.rst src/osm_ngsa/README.rst' |
| 134 | python3 setup.py --command-packages=stdeb.command sdist_dsc |
| 135 | sh -c 'cd deb_dist/osm-ngsa*/ && dpkg-buildpackage -rfakeroot -uc -us' |
| 136 | sh -c 'rm src/osm_ngsa/requirements.txt' |
| 137 | sh -c 'rm src/osm_ngsa/README.rst' |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 138 | |
| 139 | |
| 140 | ####################################################################################### |
| 141 | [testenv:dist_webhook_translator] |
| 142 | deps = -r{toxinidir}/osm_webhook_translator/requirements.txt |
| 143 | -r{toxinidir}/osm_webhook_translator/requirements-dist.txt |
| garciadeblas | 239971d | 2023-03-23 11:46:36 +0100 | [diff] [blame] | 144 | allowlist_externals = sh |
| garciadeblas | 9cbad10 | 2023-04-05 11:09:19 +0200 | [diff] [blame] | 145 | commands = |
| 146 | sh -c 'cp src/osm_ngsa/_version.py osm_webhook_translator/src/osm_webhook_translator/_version.py' |
| 147 | sh -c 'cd osm_webhook_translator && cp requirements.txt src/osm_webhook_translator/requirements.txt' |
| 148 | sh -c 'cd osm_webhook_translator && cp README.rst src/osm_webhook_translator/README.rst' |
| 149 | sh -c 'cd osm_webhook_translator && python3 setup.py --command-packages=stdeb.command sdist_dsc' |
| 150 | sh -c 'cd osm_webhook_translator/deb_dist/osm-webhook-translator*/ && dpkg-buildpackage -rfakeroot -uc -us' |
| 151 | sh -c 'rm osm_webhook_translator/src/osm_webhook_translator/requirements.txt' |
| 152 | sh -c 'rm osm_webhook_translator/src/osm_webhook_translator/README.rst' |
| garciadeblas | 8d41d56 | 2022-11-24 14:42:35 +0100 | [diff] [blame] | 153 | |
| 154 | |
| 155 | ####################################################################################### |
| garciadeblas | 6683456 | 2022-11-10 14:07:04 +0100 | [diff] [blame] | 156 | [flake8] |
| 157 | ignore = |
| 158 | W291, |
| 159 | W293, |
| 160 | W503, |
| 161 | W605, |
| 162 | E123, |
| 163 | E125, |
| 164 | E203, |
| 165 | E226, |
| 166 | E241, |
| 167 | E501, |
| 168 | exclude = |
| 169 | .git, |
| 170 | __pycache__, |
| 171 | .tox, |
| 172 | max-line-length = 120 |
| 173 | show-source = True |
| 174 | builtins = _ |
| 175 | import-order-style = google |