Skip to content

Enforce the existing 100% coverage of the Python layer in CI - #241

Closed
tschm wants to merge 1 commit into
bodono:masterfrom
tschm:fix/238-coverage-gate
Closed

tschm wants to merge 1 commit into
bodono:masterfrom
tschm:fix/238-coverage-gate

Conversation

@tschm

@tschm tschm commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Closes #238

scs/py/__init__.py is at 100% statement coverage today, but nothing measures it, so a regression would land silently.

The reason it was never wired up is a real trap: --cov=scs collects nothing when pytest runs from the repo root. scs/ has no __init__.py, so coverage resolves the name to that namespace-package directory rather than to the installed package, and reports 0% with No data was collected. source_pkgs says scs is an importable package name, so coverage follows the import to site-packages instead.

  • [tool.coverage.run] source_pkgs = ["scs"] in pyproject.toml
  • [tool.coverage.report] fail_under = 100, so the CI invocation is a bare pytest --cov with no inline flags
  • pytest-cov added to build_openmp's pixi deps

Gate added to build_openmp only; the other test jobs run plain pytest, where the coverage config is inert.

Also gitignores the coverage data files — the existing entry was python/.coverage, from the pre-meson layout.

Verified locally from the repo root:

site-packages/scs/__init__.py   114   0   100%
Required test coverage of 100.0% reached. Total coverage: 100.00%
396 passed, 67 skipped

The threshold is safe cross-platform: test_scs_coverage.py mocks sys.platform for darwin, linux and win32, so _resolve_auto's branches are covered regardless of the runner.

🤖 Generated with Claude Code

`--cov=scs` measures nothing when pytest runs from the repo root: `scs/` has
no `__init__.py`, so coverage resolves the name to that namespace-package
directory rather than to the installed package, and reports 0% with "No data
was collected". `source_pkgs` states that `scs` is an importable package name,
so coverage follows the import to site-packages instead.

The threshold lives in `[tool.coverage.report]`, so the CI invocation is a bare
`pytest --cov` with no inline flags. Gate added to build_openmp only; the other
test jobs run plain pytest, where the coverage config is inert.

Also gitignore the coverage data files — the existing entry was `python/.coverage`
from the pre-meson layout.

Closes bodono#238

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bodono

bodono commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the work, but as noted on #238 we're not adding a coverage gate on the Python layer. Closing.

@bodono bodono closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce the existing 100% coverage of scs/py/__init__.py in CI

2 participants