Repository navigation
fix: anchor coverage ellipsis exclude pattern to stub bodies - #1682
Merged
Merged
Conversation
…ive-computing#1681) The bare "\.\.\." exclude_lines regex matched any source line containing three dots, including lines like `generate_func: Callable[..., _T]`. When such a line opens a block, coverage.py excludes the whole block, so the function silently disappeared from the coverage report instead of showing as covered or missing. Anchor the pattern to a bare-ellipsis stub body (`^\s*\.\.\.$`) so it only matches genuine `...` stub statements, not `...` appearing inside a type annotation or elsewhere on the line. Assisted-by: pi coding agent Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
ajbozarth
approved these changes
Sep 25, 2026
jakelorocco
approved these changes
Sep 28, 2026
Merged
via the queue into
generative-computing:main
with commit Sep 28, 2026
e50deef
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Impact
Callable[..., T]type hints hide whole functions frompytest --cov.Coverage.py's
exclude_linesregex matched any line containing three dots,so a signature like
generate_func: Callable[..., _T]matched and excludedthe entire function it heads — not shown as covered, not shown as missing,
just absent from the report. In
mellea/backends/huggingface.pythis hidthree adapter-generation helper functions, and anywhere else in the codebase
a
Callable[...]annotation appears is affected the same way.Fix
Anchor the pattern to a bare stub body:
This still excludes genuine
...stubs (@generative/Protocol/abstractmethod bodies) on their own line, but no longer matches
...appearinginside a type annotation or elsewhere on the line.
Verification
Same-commit A/B (
pytest -m "not qualitative and not slow", old vs newpattern, source unchanged): identical test results both times, but 572 more
statements and 350 more branches get measured with the fix, and the three
previously-hidden
huggingface.pyfunctions now show up in the report.Fixes #1681