@@ -1,2 +1,4 @@
**/__pycache__
.pytest_cache/
+.coverage
+htmlcov/
@@ -8,3 +8,11 @@ default:
# (e.g. `just tests -k <expr>` or `just tests tests/unit`).
tests *args:
pytest {{args}}
+
+# Run the suite with a terminal branch-coverage report for wic.
+coverage *args:
+ pytest {{args}} --cov=wic --cov-branch --cov-report=term-missing
+
+# Run the suite with an HTML coverage report (written to htmlcov/).
+coverage-html *args:
+ pytest {{args}} --cov=wic --cov-branch --cov-report=term-missing --cov-report=html
@@ -24,6 +24,8 @@ Repository = "https://git.yoctoproject.org/wic"
[project.optional-dependencies]
tests = [
"pytest >= 9.1.1",
+ "coverage >= 7.15.0",
+ "pytest-cov >= 7.1.0",
"rust-just >= 1.55.1",
]
Add branch coverage of the wic source as opt-in just recipes, so a plain run stays fast and quiet. coverage and pytest-cov join the tests extra; the coverage recipe prints a terminal report of the lines that were missed, and coverage-html additionally writes a browsable report to htmlcov/. .gitignore ignores the .coverage data file and htmlcov/. AI-Generated: codex/claude-opus 4.8 (xhigh) Signed-off-by: Trevor Woerner <twoerner@gmail.com> --- changes in v4: - expose coverage through just recipes (coverage, coverage-html) rather than run-tests.sh flags. changes in v3: - no change in this revision. changes in v2: - v1 submitted the entire test suite as a single commit; v2 breaks the work into a reviewable series, and this patch is one step of it. --- .gitignore | 2 ++ justfile | 8 ++++++++ pyproject.toml | 2 ++ 3 files changed, 12 insertions(+)