Skip to content

Commit 490ff87

Browse files
authored
Add pytest-cov for coverage reporting (#20)
* Add pytest-cov for coverage reporting * add html coverage reporting ---------
1 parent 6c876ad commit 490ff87

4 files changed

Lines changed: 97 additions & 1 deletion

File tree

‎Makefile‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: setup cli migrate ingest test lint format
1+
.PHONY: setup cli migrate ingest test cov lint format
22

33
setup:
44
uv sync
@@ -18,6 +18,10 @@ ingest:
1818
test:
1919
uv run pytest
2020

21+
cov:
22+
uv run pytest --cov-report=html
23+
@echo "HTML coverage report: htmlcov/index.html"
24+
2125
lint:
2226
uv run ruff check .
2327

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ Every command runs through `uv run`, so you never need to activate the venv.
243243
| `make lint` | Run ruff (lint only, no changes) |
244244
| `make format` | Run black (rewrites files in place) |
245245
| `make test` | Run the pytest suite (requires Docker running) |
246+
| `make cov` | Run the suite and write a browsable HTML coverage report to `htmlcov/index.html` |
246247

247248
## Running checks locally
248249

‎pyproject.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dev = [
2626
"black",
2727
"psycopg2-binary",
2828
"pre-commit>=4.6.0",
29+
"pytest-cov>=7.1.0",
2930
]
3031

3132
[tool.ruff]
@@ -47,3 +48,8 @@ asyncio_mode = "auto"
4748
asyncio_default_fixture_loop_scope = "session"
4849
asyncio_default_test_loop_scope = "session"
4950
testpaths = ["tests"]
51+
addopts = "--cov=src --cov-report=term-missing"
52+
53+
[tool.coverage.run]
54+
source = ["src"]
55+
omit = ["src/infrastructure/db/versions/*"]

0 commit comments

Comments
 (0)