blob: 1f9442e3716ae0dbdc8ad1888162d1c9f5872f4b [file] [log] [blame]
David Garcia49379ce2021-02-24 13:48:22 +01001# Copyright 2021 Canonical Ltd.
beierlma4a37f72020-06-26 12:55:01 -04002#
David Garcia95ba7e12021-02-03 11:10:28 +01003# 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
beierlma4a37f72020-06-26 12:55:01 -04006#
David Garcia95ba7e12021-02-03 11:10:28 +01007# http://www.apache.org/licenses/LICENSE-2.0
beierlma4a37f72020-06-26 12:55:01 -04008#
David Garcia95ba7e12021-02-03 11:10:28 +01009# 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 Garcia49379ce2021-02-24 13:48:22 +010021#######################################################################################
beierlma4a37f72020-06-26 12:55:01 -040022
23[tox]
David Garcia49379ce2021-02-24 13:48:22 +010024envlist = flake8, cover, pylint, safety, yamllint
beierlma4a37f72020-06-26 12:55:01 -040025skipsdist = True
26
27[testenv]
David Garcia95ba7e12021-02-03 11:10:28 +010028basepython = python3.8
29setenv =
David Garcia49379ce2021-02-24 13:48:22 +010030 VIRTUAL_ENV={envdir}
David Garcia95ba7e12021-02-03 11:10:28 +010031 PYTHONHASHSEED=0
32 PYTHONPATH = {toxinidir}/src
David Garcia49379ce2021-02-24 13:48:22 +010033deps = -r{toxinidir}/requirements.txt
David Garcia68faf8d2020-09-01 10:12:16 +020034
David Garcia49379ce2021-02-24 13:48:22 +010035#######################################################################################
36[testenv:cover]
37deps = {[testenv]deps}
38 -r{toxinidir}/requirements-test.txt
39commands =
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*
46whitelist_externals = sh
47
48#######################################################################################
49[testenv:safety]
50setenv =
51 LC_ALL=C.UTF-8
52 LANG=C.UTF-8
53deps = {[testenv]deps}
54 -r{toxinidir}/requirements-test.txt
55commands =
56 - safety check --full-report
57
58#######################################################################################
59[testenv:flake8]
60deps = flake8
61commands =
62 flake8 src/ tests/
63
64#######################################################################################
65[testenv:pylint]
66deps = {[testenv]deps}
67 -r{toxinidir}/requirements-test.txt
68 pylint
69commands =
70 pylint -E src
71
72#######################################################################################
73[testenv:black]
74deps = {[testenv]deps}
75 -r{toxinidir}/requirements-test.txt
76 black
77commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
78
79#######################################################################################
80[testenv:yamllint]
81deps = {[testenv]deps}
82 -r{toxinidir}/requirements-test.txt
83 yamllint
84commands = yamllint .
85
86#######################################################################################
David Garcia68faf8d2020-09-01 10:12:16 +020087[testenv:build]
David Garcia68faf8d2020-09-01 10:12:16 +020088passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
David Garcia49379ce2021-02-24 13:48:22 +010089deps = {[testenv]deps}
90 -r{toxinidir}/requirements-test.txt
91 charmcraft
David Garcia95ba7e12021-02-03 11:10:28 +010092whitelist_externals =
93 charmcraft
David Garcia49379ce2021-02-24 13:48:22 +010094 cp
David Garcia68faf8d2020-09-01 10:12:16 +020095commands =
David Garcia95ba7e12021-02-03 11:10:28 +010096 charmcraft build
David Garcia49379ce2021-02-24 13:48:22 +010097 cp -r build release
David Garcia68faf8d2020-09-01 10:12:16 +020098
David Garcia49379ce2021-02-24 13:48:22 +010099#######################################################################################
100[flake8]
101ignore =
102 W291,
103 W293,
104 E123,
105 E125,
106 E226,
107 E241,
108exclude =
109 .git,
110 __pycache__,
111 .tox,
112max-line-length = 120
113show-source = True
114builtins = _
David Garcia95ba7e12021-02-03 11:10:28 +0100115