🧠 Context
We run pytest in CI but have no visibility into how much of the codebase the tests actually cover. As we add service-level tests and onboard contributors, a coverage number makes the gaps concrete and shows whether new tests are landing where they matter.
This ticket integrates pytest-cov so every test run reports a coverage percentage. We just want the number reported for now — no enforced minimum.
🛠 Implementation Plan
- Add the dev dependency:
uv add --dev pytest-cov, and commit the updated uv.lock (CI runs uv sync --frozen, so a stale lock fails the build).
- Add a
[tool.coverage.run] section to pyproject.toml:
source = ["src"]
- Omit the Alembic migrations (
src/infrastructure/db/versions/*) — they aren't unit-tested and would only drag the number down.
- Make the test run report coverage — add
--cov=src (e.g. via pytest addopts in pyproject.toml, so it applies locally and in CI alike). A terminal summary report (--cov-report=term-missing) is a good default.
- Confirm the coverage summary shows up in CI's test job output.
Notes
- Do not add a
--cov-fail-under / minimum threshold. Current coverage is low (mostly the repository tests), so a threshold would fail CI on every open PR. We only want the number visible for now; ratcheting up a minimum is a later decision.
- Coverage runs through the normal test suite, so the same prerequisites apply — Docker must be running for the DB tests (
make test).
✅ Acceptance Criteria
pytest-cov is in the dev dependency group and the updated uv.lock is committed (CI's --frozen sync passes).
- Running the test suite prints a coverage report covering
src/ (migrations excluded).
- The coverage summary is visible in CI's test job output.
- No minimum-coverage threshold is enforced.
make test and make lint pass.
🧠 Context
We run
pytestin CI but have no visibility into how much of the codebase the tests actually cover. As we add service-level tests and onboard contributors, a coverage number makes the gaps concrete and shows whether new tests are landing where they matter.This ticket integrates
pytest-covso every test run reports a coverage percentage. We just want the number reported for now — no enforced minimum.🛠 Implementation Plan
uv add --dev pytest-cov, and commit the updateduv.lock(CI runsuv sync --frozen, so a stale lock fails the build).[tool.coverage.run]section topyproject.toml:source = ["src"]src/infrastructure/db/versions/*) — they aren't unit-tested and would only drag the number down.--cov=src(e.g. via pytestaddoptsinpyproject.toml, so it applies locally and in CI alike). A terminal summary report (--cov-report=term-missing) is a good default.Notes
--cov-fail-under/ minimum threshold. Current coverage is low (mostly the repository tests), so a threshold would fail CI on every open PR. We only want the number visible for now; ratcheting up a minimum is a later decision.make test).✅ Acceptance Criteria
pytest-covis in the dev dependency group and the updateduv.lockis committed (CI's--frozensync passes).src/(migrations excluded).make testandmake lintpass.