forked from canonical/cos-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
99 lines (90 loc) · 2.69 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
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
envlist = fetch-libs, lint, static, unit
isolated_build=true
[vars]
src_path = {toxinidir}/src
tst_path = {toxinidir}/tests
all_path = {[vars]src_path} {[vars]tst_path}
[testenv]
basepython = python3
setenv =
PYTHONPATH = {[vars]src_path}
PY_COLORS=1
passenv =
PYTHONPATH
HOME
PATH
[testenv:fetch-libs]
allowlist_externals = charmcraft
commands =
# fetch all charm libs required by the coordinated_workers package
charmcraft fetch-lib charms.data_platform_libs.v0.s3
charmcraft fetch-lib charms.grafana_k8s.v0.grafana_source
charmcraft fetch-lib charms.grafana_k8s.v0.grafana_dashboard
charmcraft fetch-lib charms.observability_libs.v1.cert_handler
charmcraft fetch-lib charms.prometheus_k8s.v0.prometheus_scrape
charmcraft fetch-lib charms.loki_k8s.v1.loki_push_api
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.tracing
charmcraft fetch-lib charms.observability_libs.v0.kubernetes_compute_resources_patch
charmcraft fetch-lib charms.tls_certificates_interface.v3.tls_certificates
[testenv:fmt]
description = Apply coding style standards to code
deps =
black
ruff
commands =
black {[vars]all_path}
ruff check --fix {[vars]all_path}
[testenv:lint]
description = Check code against coding style standards
deps =
black
ruff
codespell
commands =
codespell {[vars]all_path}
ruff check {[vars]all_path}
black --check --diff {[vars]all_path}
[testenv:static]
description = Run static analysis checks
deps =
ops[testing]
PyYAML
typing_extensions
pyright
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib
commands =
pyright {[vars]src_path}
[testenv:unit]
description = Run unit tests
deps =
deepdiff
fs
pytest
pytest-cov
ops[testing]
PyYAML
typing_extensions
cryptography
jsonschema
lightkube>=v0.15.4
lightkube-models==1.24.1.4
allowlist_externals =
/usr/bin/env
charmcraft
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib
commands =
python -m doctest {[vars]src_path}/cosl/mandatory_relation_pairs.py
/usr/bin/env sh -c 'stat cos-tool-amd64 > /dev/null 2>&1 || curl -L -O https://github.com/canonical/cos-tool/releases/latest/download/cos-tool-amd64'
pytest {tty:--color=yes} --cov={[vars]src_path} --cov-config={tox_root}/pyproject.toml \
; for us
--cov-report=html:{tox_root}/results/html-cov/ \
; for tiobe
--cov-report=xml:{tox_root}/results/coverage-{env_name}.xml \
; for sparta
--cov-report=json:{tox_root}/results/tox-{env_name}.json \
--junit-xml={tox_root}/results/test-results-{env_name}.xml {posargs}