blob: f207ac34571cbb2d2c83fc88a537e028d75d7c72 [file] [log] [blame]
sousaedu903379c2021-02-08 13:34:21 +01001# 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##
sousaedu10721602021-05-18 17:28:17 +020021#######################################################################################
sousaedu903379c2021-02-08 13:34:21 +010022
23[tox]
sousaedu10721602021-05-18 17:28:17 +020024envlist = black, cover, flake8, pylint, yamllint, safety
25skipsdist = true
26
27[tox:jenkins]
28toxworkdir = /tmp/.tox
sousaedu903379c2021-02-08 13:34:21 +010029
30[testenv]
sousaedu10721602021-05-18 17:28:17 +020031basepython = python3.8
32setenv = VIRTUAL_ENV={envdir}
33 PYTHONDONTWRITEBYTECODE = 1
34deps = -r{toxinidir}/requirements.txt
sousaedu903379c2021-02-08 13:34:21 +010035
sousaedu10721602021-05-18 17:28:17 +020036
37#######################################################################################
38[testenv:black]
39deps = black
40commands =
41 black --check --diff src/ tests/
42
43
44#######################################################################################
45[testenv:cover]
46deps = {[testenv]deps}
47 -r{toxinidir}/requirements-test.txt
48 coverage
49 nose2
50commands =
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*
57whitelist_externals = sh
58
59
60#######################################################################################
61[testenv:flake8]
62deps = flake8
63 flake8-import-order
64commands =
65 flake8 src/ tests/
66
67
68#######################################################################################
69[testenv:pylint]
70deps = {[testenv]deps}
71 -r{toxinidir}/requirements-test.txt
72 pylint
73commands =
74 pylint -E src/ tests/
75
76
77#######################################################################################
78[testenv:safety]
79setenv =
80 LC_ALL=C.UTF-8
81 LANG=C.UTF-8
82deps = {[testenv]deps}
83 safety
84commands =
85 - safety check --full-report
86
87
88#######################################################################################
89[testenv:yamllint]
90deps = {[testenv]deps}
91 -r{toxinidir}/requirements-test.txt
92 yamllint
93commands = yamllint .
94
95#######################################################################################
sousaedu903379c2021-02-08 13:34:21 +010096[testenv:build]
97passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
sousaedu10721602021-05-18 17:28:17 +020098deps = charmcraft
sousaedu903379c2021-02-08 13:34:21 +010099whitelist_externals =
100 charmcraft
sousaedu10721602021-05-18 17:28:17 +0200101 cp
sousaedu903379c2021-02-08 13:34:21 +0100102commands =
sousaedu903379c2021-02-08 13:34:21 +0100103 charmcraft build
sousaedu10721602021-05-18 17:28:17 +0200104 cp -r build release
sousaedu903379c2021-02-08 13:34:21 +0100105
sousaedu10721602021-05-18 17:28:17 +0200106#######################################################################################
107[flake8]
108ignore =
109 W291,
110 W293,
111 W503,
112 E123,
113 E125,
114 E226,
115 E241,
116exclude =
117 .git,
118 __pycache__,
119 .tox,
120max-line-length = 120
121show-source = True
122builtins = _
123max-complexity = 10
124import-order-style = google