-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtox.ini
61 lines (52 loc) · 1.68 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
# Copyright 2021 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
skipsdist = True
skip_missing_interpreters = True
envlist = lint, static, unit
[vars]
src_path = {toxinidir}/src
tst_path = {toxinidir}/tests
lib_path = {toxinidir}/lib/charms/grafana_agent/v0
all_path = {[vars]src_path} {[vars]tst_path} {[vars]lib_path}
uv_flags = --frozen --isolated --extra=dev
[testenv]
allowlist_externals = uv
basepython = python3
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib:{[vars]src_path}
PYTHONBREAKPOINT=ipdb.set_trace
PY_COLORS=1
passenv =
PYTHONPATH
CHARM_PATH
[testenv:lock]
description = Update uv.lock with the latest deps
commands =
uv lock --upgrade --no-cache
[testenv:lint]
description = Lint the code
commands =
uv run {[vars]uv_flags} ruff check {[vars]all_path}
[testenv:static]
description = Run static checks
allowlist_externals =
{[testenv]allowlist_externals}
/usr/bin/env
commands =
uv run {[vars]uv_flags} pyright {[vars]all_path}
/usr/bin/env sh -c 'for m in $(git diff main --name-only {[vars]lib_path}); do if ! git diff main $m | grep -q "+LIBPATCH\|+LIBAPI"; then echo "You forgot to bump the version on $m!"; exit 1; fi; done'
[testenv:fmt]
description = Format the code
commands =
uv run {[vars]uv_flags} ruff check --fix-only {[vars]all_path}
[testenv:unit]
description = Run unit tests
commands =
uv run {[vars]uv_flags} coverage run --source={[vars]src_path},{[vars]lib_path} -m pytest \
{[vars]tst_path}/unit {posargs}
uv run {[vars]uv_flags} coverage report
[testenv:integration]
description = Run integration tests
commands =
uv run {[vars]uv_flags} pytest --exitfirst {[vars]tst_path}/integration {posargs}