| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 1 | # Copyright 2021 Canonical Ltd. |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [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 | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 22 | |
| 23 | [tox] |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 24 | envlist = flake8, cover, pylint, safety, yamllint |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 25 | skipsdist = True |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 26 | |
| 27 | [testenv] |
| David Garcia | 95ba7e1 | 2021-02-03 11:10:28 +0100 | [diff] [blame] | 28 | basepython = python3.8 |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 29 | setenv = |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 30 | VIRTUAL_ENV={envdir} |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 31 | PYTHONHASHSEED=0 |
| 32 | PYTHONPATH = {toxinidir}/src |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 33 | deps = -r{toxinidir}/requirements.txt |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 34 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 35 | ####################################################################################### |
| 36 | [testenv:cover] |
| 37 | deps = {[testenv]deps} |
| 38 | -r{toxinidir}/requirements-test.txt |
| 39 | commands = |
| 40 | sh -c 'rm -f nosetests.xml' |
| 41 | coverage erase |
| 42 | nose2 -C --coverage src |
| 43 | coverage report --omit='*tests*' |
| 44 | coverage html -d ./cover --omit='*tests*' |
| 45 | coverage xml -o coverage.xml --omit=*tests* |
| 46 | whitelist_externals = sh |
| 47 | |
| 48 | ####################################################################################### |
| 49 | [testenv:safety] |
| 50 | setenv = |
| 51 | LC_ALL=C.UTF-8 |
| 52 | LANG=C.UTF-8 |
| 53 | deps = {[testenv]deps} |
| 54 | -r{toxinidir}/requirements-test.txt |
| 55 | commands = |
| 56 | - safety check --full-report |
| 57 | |
| 58 | ####################################################################################### |
| 59 | [testenv:flake8] |
| 60 | deps = flake8 |
| 61 | commands = |
| 62 | flake8 src/ tests/ |
| 63 | |
| 64 | ####################################################################################### |
| 65 | [testenv:pylint] |
| 66 | deps = {[testenv]deps} |
| 67 | -r{toxinidir}/requirements-test.txt |
| 68 | pylint |
| 69 | commands = |
| 70 | pylint -E src |
| 71 | |
| 72 | ####################################################################################### |
| 73 | [testenv:black] |
| 74 | deps = {[testenv]deps} |
| 75 | -r{toxinidir}/requirements-test.txt |
| 76 | black |
| 77 | commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/" |
| 78 | |
| 79 | ####################################################################################### |
| 80 | [testenv:yamllint] |
| 81 | deps = {[testenv]deps} |
| 82 | -r{toxinidir}/requirements-test.txt |
| 83 | yamllint |
| 84 | commands = yamllint . |
| 85 | |
| 86 | ####################################################################################### |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 87 | [testenv:build] |
| 88 | passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 89 | deps = {[testenv]deps} |
| 90 | -r{toxinidir}/requirements-test.txt |
| 91 | charmcraft |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 92 | whitelist_externals = |
| 93 | charmcraft |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 94 | cp |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 95 | commands = |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 96 | charmcraft build |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 97 | cp -r build release |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 98 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame^] | 99 | ####################################################################################### |
| 100 | [flake8] |
| 101 | ignore = |
| 102 | W291, |
| 103 | W293, |
| 104 | E123, |
| 105 | E125, |
| 106 | E226, |
| 107 | E241, |
| 108 | exclude = |
| 109 | .git, |
| 110 | __pycache__, |
| 111 | .tox, |
| 112 | max-line-length = 120 |
| 113 | show-source = True |
| 114 | builtins = _ |
| sousaedu | abe7321 | 2020-11-04 15:13:35 +0000 | [diff] [blame] | 115 | |