Major improvement in OSM charms
[osm/devops.git] / installers / charm / prometheus / tox.ini
1 # Copyright 2021 Canonical Ltd.
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 ##
21 #######################################################################################
22
23 [tox]
24 envlist = flake8, cover, pylint, safety, yamllint
25 skipsdist = True
26
27 [testenv]
28 basepython = python3.8
29 setenv =
30 VIRTUAL_ENV={envdir}
31 PYTHONHASHSEED=0
32 PYTHONPATH = {toxinidir}/src
33 deps = -r{toxinidir}/requirements.txt
34
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 #######################################################################################
87 [testenv:build]
88 passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
89 deps = {[testenv]deps}
90 -r{toxinidir}/requirements-test.txt
91 charmcraft
92 whitelist_externals =
93 charmcraft
94 cp
95 commands =
96 charmcraft build
97 cp -r build release
98
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 = _
115