diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc8fd9a..e843ec6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,4 +52,10 @@ jobs: - name: Test # Network I/O is isolated in the *_utils modules and mocked there, so # the suite needs neither a live network nor any external binary. - run: pytest --tb=short -q + # + # --cov-fail-under lives here rather than in pyproject addopts: in + # addopts it also applies to targeted runs such as + # `pytest tests/test_x.py::TestY -v`, which measure the whole package + # while executing one class and so fail the gate at ~3% coverage even + # when every selected test passes. + run: pytest --tb=short -q --cov-fail-under=100 diff --git a/CLAUDE.md b/CLAUDE.md index 60f1962..8af74aa 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -70,7 +70,8 @@ Two mock targets in tests: - **CLI mocking**: patch `"quantumvalidator.assessor.assess"` and `"quantumvalidator.reporter.print_full_report"` (both are lazy imports inside `check()`) - **Reporter tests**: use `Console(file=StringIO(), no_color=True, width=200)` to capture output; pass `console=con` as a keyword argument — all reporter functions (public and private) accept `console=` - **Test class naming**: `class TestFeatureName:`, snake_case methods, AAA structure -- **Coverage target**: 100% — enforced via `pyproject.toml` addopts +- **Coverage target**: 100% — enforced by CI (`--cov-fail-under=100` on the + workflow's pytest step, not in `addopts`, so targeted runs are not gated) ## Exit Codes diff --git a/pyproject.toml b/pyproject.toml index 49b36c4..50410b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,4 +74,4 @@ select = ["E4", "E7", "E9", "F"] [tool.pytest.ini_options] pythonpath = ["."] testpaths = ["tests"] -addopts = "--cov=quantumvalidator --cov-report=term-missing --cov-fail-under=100" +addopts = "--cov=quantumvalidator --cov-report=term-missing"