| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 1 | # Copyright 2021 Canonical Ltd. |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | # |
| 15 | # For those usages not covered by the Apache License, Version 2.0 please |
| 16 | # contact: legal@canonical.com |
| 17 | # |
| 18 | # To get in touch with the maintainers, please contact: |
| 19 | # osm-charmers@lists.launchpad.net |
| 20 | ## |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 21 | ####################################################################################### |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 22 | |
| 23 | [tox] |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 24 | envlist = black, cover, flake8, pylint, yamllint, safety |
| 25 | skipsdist = true |
| 26 | |
| 27 | [tox:jenkins] |
| 28 | toxworkdir = /tmp/.tox |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 29 | |
| 30 | [testenv] |
| David Garcia | 95ba7e1 | 2021-02-03 11:10:28 +0100 | [diff] [blame] | 31 | basepython = python3.8 |
| David Garcia | 4a0db7c | 2022-02-21 11:48:11 +0100 | [diff] [blame] | 32 | setenv = |
| 33 | VIRTUAL_ENV={envdir} |
| 34 | PYTHONPATH = {toxinidir}:{toxinidir}/lib:{toxinidir}/src |
| 35 | PYTHONDONTWRITEBYTECODE = 1 |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 36 | deps = -r{toxinidir}/requirements.txt |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 37 | |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 38 | |
| 39 | ####################################################################################### |
| 40 | [testenv:black] |
| 41 | deps = black |
| 42 | commands = |
| 43 | black --check --diff src/ tests/ |
| 44 | |
| 45 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 46 | ####################################################################################### |
| 47 | [testenv:cover] |
| 48 | deps = {[testenv]deps} |
| 49 | -r{toxinidir}/requirements-test.txt |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 50 | coverage |
| 51 | nose2 |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 52 | commands = |
| 53 | sh -c 'rm -f nosetests.xml' |
| 54 | coverage erase |
| 55 | nose2 -C --coverage src |
| 56 | coverage report --omit='*tests*' |
| 57 | coverage html -d ./cover --omit='*tests*' |
| 58 | coverage xml -o coverage.xml --omit=*tests* |
| 59 | whitelist_externals = sh |
| 60 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 61 | |
| 62 | ####################################################################################### |
| 63 | [testenv:flake8] |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 64 | deps = flake8 |
| 65 | flake8-import-order |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 66 | commands = |
| 67 | flake8 src/ tests/ |
| 68 | |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 69 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 70 | ####################################################################################### |
| 71 | [testenv:pylint] |
| 72 | deps = {[testenv]deps} |
| 73 | -r{toxinidir}/requirements-test.txt |
| David Garcia | ca7d1b9 | 2021-09-30 10:35:54 +0200 | [diff] [blame] | 74 | pylint==2.10.2 |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 75 | commands = |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 76 | pylint -E src/ tests/ |
| 77 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 78 | |
| 79 | ####################################################################################### |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 80 | [testenv:safety] |
| 81 | setenv = |
| 82 | LC_ALL=C.UTF-8 |
| 83 | LANG=C.UTF-8 |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 84 | deps = {[testenv]deps} |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 85 | safety |
| 86 | commands = |
| 87 | - safety check --full-report |
| 88 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 89 | |
| 90 | ####################################################################################### |
| 91 | [testenv:yamllint] |
| 92 | deps = {[testenv]deps} |
| 93 | -r{toxinidir}/requirements-test.txt |
| 94 | yamllint |
| 95 | commands = yamllint . |
| 96 | |
| 97 | ####################################################################################### |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 98 | [testenv:build] |
| 99 | passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY |
| 100 | whitelist_externals = |
| 101 | charmcraft |
| David Garcia | d680be4 | 2021-08-17 11:03:55 +0200 | [diff] [blame] | 102 | sh |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 103 | commands = |
| David Garcia | 4a0db7c | 2022-02-21 11:48:11 +0100 | [diff] [blame] | 104 | charmcraft pack |
| David Garcia | d680be4 | 2021-08-17 11:03:55 +0200 | [diff] [blame] | 105 | sh -c 'ubuntu_version=20.04; \ |
| 106 | architectures="amd64-aarch64-arm64"; \ |
| 107 | charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \ |
| 108 | mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm' |
| sousaedu | 6248fe6 | 2020-10-13 23:46:51 +0100 | [diff] [blame] | 109 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 110 | ####################################################################################### |
| 111 | [flake8] |
| 112 | ignore = |
| 113 | W291, |
| 114 | W293, |
| sousaedu | 996a560 | 2021-05-03 00:22:43 +0200 | [diff] [blame] | 115 | W503, |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 116 | E123, |
| 117 | E125, |
| 118 | E226, |
| 119 | E241, |
| 120 | exclude = |
| 121 | .git, |
| 122 | __pycache__, |
| 123 | .tox, |
| 124 | max-line-length = 120 |
| 125 | show-source = True |
| 126 | builtins = _ |
| David Garcia | c753dc5 | 2021-03-17 15:28:47 +0100 | [diff] [blame] | 127 | max-complexity = 10 |
| 128 | import-order-style = google |