Skip to content

fix: anchor coverage ellipsis exclude pattern to stub bodies - #1682

Merged
jakelorocco merged 1 commit into
generative-computing:mainfrom
planetf1:issue-1681
Sep 28, 2026
Merged

jakelorocco merged 1 commit into
generative-computing:mainfrom
planetf1:issue-1681

Conversation

@planetf1

@planetf1 planetf1 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Impact

Callable[..., T] type hints hide whole functions from pytest --cov.
Coverage.py's exclude_lines regex matched any line containing three dots,
so a signature like generate_func: Callable[..., _T] matched and excluded
the entire function it heads — not shown as covered, not shown as missing,
just absent from the report. In mellea/backends/huggingface.py this hid
three 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:

-    "\\.\\.\\.",  # Ellipsis in function bodies
+    "^\\s*\\.\\.\\.$",  # Ellipsis stub bodies (not `...` inside e.g. Callable[..., T])

This still excludes genuine ... stubs (@generative/Protocol/abstract
method bodies) on their own line, but no longer matches ... appearing
inside a type annotation or elsewhere on the line.

Verification

Same-commit A/B (pytest -m "not qualitative and not slow", old vs new
pattern, 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.py functions now show up in the report.

Fixes #1681

…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>
@github-actions github-actions Bot added the bug Something isn't working label Sep 25, 2026
@planetf1
planetf1 marked this pull request as ready for review September 25, 2026 16:12
@planetf1
planetf1 requested a review from a team as a code owner September 25, 2026 16:12
@jakelorocco
jakelorocco added this pull request to the merge queue Sep 28, 2026
Merged via the queue into generative-computing:main with commit e50deef Sep 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(coverage): the ... exclude rule hides whole functions from the coverage report

3 participants