From 6a2d7155cb02db6bfd51ecde22bf475582d56ee7 Mon Sep 17 00:00:00 2001 From: counterweight Date: Sun, 21 Dec 2025 21:55:04 +0100 Subject: [PATCH] Add pytest-cov for test coverage - Add pytest-cov as dev dependency - Configure coverage in pyproject.toml - Exclude tests, __pycache__, seed.py from coverage - Enable branch coverage - Add .coverage to gitignore --- .gitignore | 1 + backend/pyproject.toml | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index e11478a..0c41813 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ next_pr.md # Notes notes/ +.coverage diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 2427cdc..bc09aae 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -21,6 +21,7 @@ dev = [ "aiosqlite>=0.20.0", "mypy>=1.13.0", "ruff>=0.14.10", + "pytest-cov>=7.0.0", ] [tool.mypy] @@ -55,3 +56,15 @@ quote-style = "double" [tool.ruff.lint.per-file-ignores] "tests/*" = ["E501"] # Allow longer lines in tests for readability +[tool.coverage.run] +source = ["."] +omit = ["tests/*", "__pycache__/*", "seed.py"] +branch = true + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "if TYPE_CHECKING:", +] +show_missing = true +