Skip to content

Commit 7cdedb7

Browse files
committed
Add tox configuration for testing and linting across major python versions, coverage, and linting
1 parent a3b320a commit 7cdedb7

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

PUBLISHING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ The publish workflow uses GitHub environments with trusted publishing (no API to
6161
2. **Update changelog** (if exists) or create release notes
6262

6363
3. **Run tests locally**:
64+
65+
To run all tests across all supported Python versions, coverage, linting, and static analysis, use:
66+
```bash
67+
uv run tox
68+
```
69+
70+
To run specific tests use:
6471
```bash
6572
uv run pytest
6673
uv run ruff check .

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ authors = [
88
]
99
requires-python = ">=3.8"
1010
dependencies = [
11+
"tox>=4.25.0",
12+
"tox-uv>=1.13.1",
1113
"typing-extensions>=4.0.0; python_version < '3.10'",
1214
]
1315
license = { text = "MIT" }

tox.ini

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[tox]
2+
requires =
3+
tox>=4
4+
envlist = py38, py39, py310, py311, py312, py313, py314, py314t, coverage, lint, format-check, type
5+
skip_missing_interpreters =
6+
True
7+
8+
[testenv]
9+
deps =
10+
pytest>=7.4.0,<8.0.0
11+
pytest-cov>=4.1.0
12+
pytest-asyncio>=0.21.0,<0.24.0
13+
pytest-mock>=3.11.0
14+
pytest-timeout>=2.1.0
15+
pytest-xdist>=3.3.0
16+
commands =
17+
pytest
18+
19+
[testenv:py]
20+
description = run tests with the current interpreter (used by CI)
21+
commands =
22+
pytest
23+
24+
[testenv:fix]
25+
description = run code formatter and linter (auto-fix)
26+
skip_install = true
27+
deps =
28+
pre-commit-uv>=4.1.1
29+
commands =
30+
pre-commit run --all-files --show-diff-on-failure
31+
32+
[testenv:lint]
33+
description = run linter via ruff
34+
skip_install = true
35+
deps =
36+
ruff>=0.14.2
37+
commands =
38+
ruff check {posargs:src tests}
39+
40+
[testenv:format]
41+
description = run formatter via ruff
42+
skip_install = true
43+
deps =
44+
ruff>=0.14.2
45+
commands =
46+
ruff format {posargs:src tests}
47+
48+
[testenv:format-check]
49+
description = check code formatting via ruff
50+
skip_install = true
51+
deps =
52+
ruff>=0.14.2
53+
commands =
54+
ruff format --check {posargs:src tests}
55+
56+
[testenv:type]
57+
description = run type checker via mypy
58+
deps =
59+
mypy
60+
commands =
61+
mypy {posargs:src}
62+
63+
[testenv:dev]
64+
runner = uv-venv-lock-runner
65+
description = dev environment
66+
extras =
67+
dev
68+
test
69+
type
70+
commands =
71+
uv pip tree

0 commit comments

Comments
 (0)