e063dd4fb54d9fa1a1fd2abef4c8931133e4f7d5
[osm/devops.git] / installers / charm / vca-integrator-operator / tox.ini
1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
17
18 [tox]
19 skipsdist=True
20 skip_missing_interpreters = True
21 envlist = lint, unit
22
23 [vars]
24 src_path = {toxinidir}/src/
25 tst_path = {toxinidir}/tests/
26 lib_path = {toxinidir}/lib/charms/osm_vca_integrator
27 all_path = {[vars]src_path} {[vars]tst_path} {[vars]lib_path}
28
29 [testenv]
30 basepython = python3.8
31 setenv =
32 PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
33 PYTHONBREAKPOINT=ipdb.set_trace
34 PY_COLORS=1
35 passenv =
36 PYTHONPATH
37 CHARM_BUILD_DIR
38 MODEL_SETTINGS
39
40 [testenv:fmt]
41 description = Apply coding style standards to code
42 deps =
43 black
44 isort
45 commands =
46 isort {[vars]all_path}
47 black {[vars]all_path}
48
49 [testenv:lint]
50 description = Check code against coding style standards
51 deps =
52 black
53 flake8
54 flake8-docstrings
55 flake8-builtins
56 pylint
57 pyproject-flake8
58 pep8-naming
59 isort
60 codespell
61 yamllint
62 -r{toxinidir}/requirements.txt
63 commands =
64 codespell {[vars]lib_path}
65 codespell {toxinidir} --skip {toxinidir}/.git --skip {toxinidir}/.tox \
66 --skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \
67 --skip {toxinidir}/.mypy_cache --skip {toxinidir}/icon.svg
68 pylint -E {[vars]src_path}
69 # pflake8 wrapper supports config from pyproject.toml
70 pflake8 {[vars]all_path}
71 isort --check-only --diff {[vars]all_path}
72 black --check --diff {[vars]all_path}
73
74 [testenv:unit]
75 description = Run unit tests
76 deps =
77 pytest
78 pytest-mock
79 coverage[toml]
80 -r{toxinidir}/requirements.txt
81 commands =
82 coverage run --source={[vars]src_path},{[vars]lib_path} \
83 -m pytest --ignore={[vars]tst_path}integration -v --tb native -s {posargs}
84 coverage report
85 coverage xml
86
87 [testenv:security]
88 description = Run security tests
89 deps =
90 bandit
91 safety
92 commands =
93 bandit -r {[vars]src_path}
94 bandit -r {[vars]lib_path}
95 - safety check
96
97 [testenv:integration]
98 description = Run integration tests
99 deps =
100 pytest
101 juju
102 pytest-operator
103 -r{toxinidir}/requirements.txt
104 -r{toxinidir}/requirements-dev.txt
105 commands =
106 pytest -v --tb native --ignore={[vars]tst_path}unit --log-cli-level=INFO -s {posargs}