You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default ... exclusion rule misses when return type annotation is split over multiple lines #2185
$ coverage erase
$ coverage run --branch -m example
$ coverage report --fail-under=100 --show-missingName Stmts Miss Branch BrPart Cover Missing--------------------------------------------------------example.py 3 0 2 1 80% 4->exit--------------------------------------------------------TOTAL 3 0 2 1 80%Coverage failure: total of 80 is less than fail-under=100
N.B. This example is a little contrived, but many formatters (e.g. ruff) will format functions like this if the annotation is too long.
$ python --version --versionPython 3.14.5 (main, May 10 2026, 10:21:34) [Clang 21.0.0 (clang-2100.0.123.102)]
$ coverage --versionCoverage.py, version 7.14.1 with C extension
$ uv pip freezeUsing Python 3.14.5 environment at: venvast-serialize==0.5.0coverage==7.14.1librt==0.11.0markdown-it-py==4.2.0mdurl==0.1.2mypy==2.1.0mypy-extensions==1.1.0pathspec==1.1.1pip==26.1.1pygments==2.20.0rich==15.0.0typing-extensions==4.15.0
Expected behavior
We expect the function to be excluded because it only contains ellipsis.
We believe this is because the regexp used to match functions containing only ellipsis expects the return type annotation to be on one line:
Activity
fix: exclude `...` bodies after multi-line return-type annotations (c…
fix: exclude `...` bodies after multi-line return-type annotations (#…
nedbat commentedon Jun 21, 2026
Fixed in commit f4b2b4d.
nedbat commentedon Jun 22, 2026
This is now released as part of coverage 7.14.3.