-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
113 lines (103 loc) · 3.11 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
no_package = True
skip_missing_interpreters = True
env_list = fmt, lint, unit, unit-library, integration
min_version = 4.0.0
[vars]
src_path = {tox_root}/src
tests_path = {tox_root}/tests
all_path = {[vars]src_path} {[vars]tests_path}
[testenv]
allowlist_externals = poetry
deps =
poetry
set_env =
PYTHONPATH = {tox_root}:{tox_root}/lib:{[vars]src_path}
PYTHONBREAKPOINT=pdb.set_trace
PY_COLORS=1
pass_env =
PYTHONPATH
CHARM_BUILD_DIR
MODEL_SETTINGS
[testenv:update-requirements]
description = Apply coding style standards to code
commands =
poetry lock
# we explicitly install poetry-plugin-export in the
# corresponding group, so we can silence the warning
poetry install --with update-requirements --no-root
poetry export -f requirements.txt -o requirements.txt --without-hashes
[testenv:fmt]
description = Apply coding style standards to code
commands =
poetry install --with fmt --no-root
ruff format {[vars]all_path}
ruff check --fix {[vars]all_path}
black {[vars]all_path}
[testenv:lint]
description = Check code against coding style standards
commands =
poetry install --with lint --no-root
# if this charm owns a lib, uncomment "lib_path" variable
# and uncomment the following line
# codespell {[vars]lib_path}
codespell {tox_root} \
--skip {tox_root}/poetry.lock \
--skip {tox_root}/venv \
--skip {tox_root}/.tox \
--skip {tox_root}/.git \
--skip {tox_root}/build \
--skip {tox_root}/src/profiles_management/pmr/schema.py
ruff check {[vars]all_path}
ruff format --check --diff {[vars]all_path}
black --check {[vars]all_path}
pyright {posargs}
[testenv:unit]
description = Run unit tests
commands =
poetry install --with unit --no-root
coverage run --source={[vars]src_path} \
-m pytest \
--tb native \
-v \
-s \
{posargs} \
{[vars]tests_path}/unit
coverage report
coverage xml
[testenv:unit-library]
description = Run unit tests of the PMR library
commands =
poetry install --with unit-library --no-root
coverage run --source={[vars]src_path} \
-m pytest \
--tb native \
-v \
-s \
--log-cli-level=INFO \
{posargs} \
{[vars]tests_path}/unit/profiles-management
coverage report
coverage xml
[testenv:integration]
description = Run integration tests
commands =
poetry install --with integration --no-root
pytest -v \
-s \
--tb native \
--log-cli-level=INFO \
{posargs} \
{[vars]tests_path}/integration
[testenv:integration-library]
description = Run integration tests of the PMR library
commands =
poetry install --with integration --no-root
pytest -v \
-s \
--tb native \
--log-cli-level=INFO \
{posargs} \
{[vars]tests_path}/integration/profiles_management