CharmHub and new kafka and zookeeper charms
[osm/devops.git] / installers / charm / pol / 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 =
33 VIRTUAL_ENV={envdir}
34 PYTHONPATH = {toxinidir}:{toxinidir}/lib:{toxinidir}/src
35 PYTHONDONTWRITEBYTECODE = 1
36 deps = -r{toxinidir}/requirements.txt
37
38
39 #######################################################################################
40 [testenv:black]
41 deps = black
42 commands =
43 black --check --diff src/ tests/
44
45
46 #######################################################################################
47 [testenv:cover]
48 deps = {[testenv]deps}
49 -r{toxinidir}/requirements-test.txt
50 coverage
51 nose2
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
61
62 #######################################################################################
63 [testenv:flake8]
64 deps = flake8
65 flake8-import-order
66 commands =
67 flake8 src/ tests/
68
69
70 #######################################################################################
71 [testenv:pylint]
72 deps = {[testenv]deps}
73 -r{toxinidir}/requirements-test.txt
74 pylint==2.10.2
75 commands =
76 pylint -E src/ tests/
77
78
79 #######################################################################################
80 [testenv:safety]
81 setenv =
82 LC_ALL=C.UTF-8
83 LANG=C.UTF-8
84 deps = {[testenv]deps}
85 safety
86 commands =
87 - safety check --full-report
88
89
90 #######################################################################################
91 [testenv:yamllint]
92 deps = {[testenv]deps}
93 -r{toxinidir}/requirements-test.txt
94 yamllint
95 commands = yamllint .
96
97 #######################################################################################
98 [testenv:build]
99 passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
100 whitelist_externals =
101 charmcraft
102 sh
103 commands =
104 charmcraft pack
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'
109
110 #######################################################################################
111 [flake8]
112 ignore =
113 W291,
114 W293,
115 W503,
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 = _
127 max-complexity = 10
128 import-order-style = google