Prepare installer and pods for Rel TWELVE
[osm/devops.git] / installers / charm / kafka / 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 = black, cover, flake8, pylint, yamllint, safety
25 skipsdist = true
26
27 [tox:jenkins]
28 toxworkdir = /tmp/.tox
29
30 [testenv]
31 basepython = python3.8
32 setenv = VIRTUAL_ENV={envdir}
33 PYTHONDONTWRITEBYTECODE = 1
34 deps = -r{toxinidir}/requirements.txt
35
36
37 #######################################################################################
38 [testenv:black]
39 deps = black
40 commands =
41 black --check --diff src/ tests/
42
43
44 #######################################################################################
45 [testenv:cover]
46 deps = {[testenv]deps}
47 -r{toxinidir}/requirements-test.txt
48 coverage
49 nose2
50 commands =
51 sh -c 'rm -f nosetests.xml'
52 coverage erase
53 nose2 -C --coverage src
54 coverage report --omit='*tests*'
55 coverage html -d ./cover --omit='*tests*'
56 coverage xml -o coverage.xml --omit=*tests*
57 whitelist_externals = sh
58
59
60 #######################################################################################
61 [testenv:flake8]
62 deps = flake8
63 flake8-import-order
64 commands =
65 flake8 src/ tests/
66
67
68 #######################################################################################
69 [testenv:pylint]
70 deps = {[testenv]deps}
71 -r{toxinidir}/requirements-test.txt
72 pylint==2.10.2
73 commands =
74 pylint -E src/ tests/
75
76
77 #######################################################################################
78 [testenv:safety]
79 setenv =
80 LC_ALL=C.UTF-8
81 LANG=C.UTF-8
82 deps = {[testenv]deps}
83 safety
84 commands =
85 - safety check --full-report
86
87
88 #######################################################################################
89 [testenv:yamllint]
90 deps = {[testenv]deps}
91 -r{toxinidir}/requirements-test.txt
92 yamllint
93 commands = yamllint .
94
95 #######################################################################################
96 [testenv:build]
97 passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
98 whitelist_externals =
99 charmcraft
100 sh
101 commands =
102 charmcraft build
103 sh -c 'ubuntu_version=20.04; \
104 architectures="amd64-aarch64-arm64"; \
105 charm_name=`cat metadata.yaml | grep -E "^name: " | cut -f 2 -d " "`; \
106 mv $charm_name"_ubuntu-"$ubuntu_version-$architectures.charm $charm_name.charm'
107
108 #######################################################################################
109 [flake8]
110 ignore =
111 W291,
112 W293,
113 W503,
114 E123,
115 E125,
116 E226,
117 E241,
118 exclude =
119 .git,
120 __pycache__,
121 .tox,
122 max-line-length = 120
123 show-source = True
124 builtins = _
125 max-complexity = 10
126 import-order-style = google