diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a01f71..3d0148b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,8 +47,11 @@ jobs: - name: Install dependencies run: uv sync --group dev - - name: Run tests - run: uv run pytest -v + - name: Run tests with coverage + # Ratchet: raise --cov-fail-under as coverage improves. Target is 80%; + # the floor starts at the currently achievable 20% so the gate blocks + # regressions today instead of failing on day one. + run: uv run pytest -v --cov --cov-report=term --cov-report=xml --cov-fail-under=20 workspace-alignment: runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index ce27432..a0162fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ dev = [ "pre-commit>=4.3.0", "pytest>=9.0.1", + "pytest-cov>=6.0", "ruff>=0.16,<0.17", ] @@ -24,6 +25,11 @@ exclude = ["repositories"] [tool.pytest.ini_options] testpaths = ["tests"] +[tool.coverage.run] +# Measure the workspace's own code only. Without this, a bare `--cov` also +# counts tests/ as covered code and reports a misleadingly high number. +source = [".ai-workspace"] + [tool.ruff.lint] select = ["E", "F", "I", "UP", "B", "SIM"] ignore = ["E501"]