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