This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
forked from canonical/ops-scenario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
100 lines (91 loc) · 2.35 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
[tox]
requires =
tox>=4.2
env_list =
py312
py311
py38
unit
lint
lint-tests
static
skip_missing_interpreters = true
[vars]
src_path = {toxinidir}/scenario
tst_path = {toxinidir}/tests
all_path = {[vars]src_path}, {[vars]tst_path}
[testenv:unit]
# don't install as a sdist, instead, install as wheel (create wheel once), then install in all envs
package = wheel
wheel_build_env = .pkg
description = unit tests
deps =
jsonpatch
pytest
pytest-cov
setenv =
PYTHONPATH = {toxinidir}
commands =
pytest --cov-report html:.cov_html -v --tb native --log-cli-level=INFO -s {posargs} {[vars]tst_path}
[testenv:lint]
description = Format the code base to adhere to our styles, and complain about what we cannot do automatically.
skip_install = true
deps =
pre-commit>=3.2.2
commands =
pre-commit run --all-files {posargs}
python -c 'print(r"hint: run {envbindir}{/}pre-commit install to add checks as pre-commit hook")'
[testenv:static]
description = Static typing checks.
skip_install = true
deps =
ops~=2.15
pyright==1.1.347
commands =
pyright scenario
[testenv:lint-tests]
description = Lint test files.
skip_install = true
deps =
black
coverage[toml]
isort
commands =
black --check {[vars]tst_path}
isort --check-only --profile black {[vars]tst_path}
[testenv:fmt]
description = Format code.
skip_install = true
deps =
ruff
isort
commands =
ruff format {[vars]tst_path} {[vars]src_path}
isort --profile black {[vars]tst_path} {[vars]src_path}
[testenv:docs-deps]
description = Compile the requirements.txt file for docs
deps = pip-tools
commands =
pip-compile --extra=docs -o docs/requirements.txt pyproject.toml
[testenv:docs]
description = Build the Sphinx docs
deps = pip-tools
commands_pre =
pip-sync {toxinidir}/docs/requirements.txt
commands =
sphinx-build -W --keep-going docs/ docs/_build/html
[testenv:test-readme]
description = Test code snippets in the README.
skip_install = true
allowlist_externals =
mkdir
cp
deps =
-e .
pytest
pytest-markdown-docs
commands =
mkdir -p {envtmpdir}/test-readme
cp {toxinidir}/README.md {envtmpdir}/test-readme/README.md
cp {toxinidir}/tests/readme-conftest.py {envtmpdir}/test-readme/conftest.py
pytest -v --tb native --log-cli-level=INFO -s {posargs} --markdown-docs {envtmpdir}/test-readme/README.md