Coverage: exclude some noise#656
Merged
JelleZijlstra merged 2 commits intopython:mainpython/typing_extensions:mainfrom Aug 24, 2025
brianschubert:coverage-exclusionsbrianschubert/typing_extensions:coverage-exclusionsCopy head branch name to clipboard
Merged
Coverage: exclude some noise#656JelleZijlstra merged 2 commits intopython:mainpython/typing_extensions:mainfrom brianschubert:coverage-exclusionsbrianschubert/typing_extensions:coverage-exclusionsCopy head branch name to clipboard
JelleZijlstra merged 2 commits intopython:mainpython/typing_extensions:mainfrom
brianschubert:coverage-exclusionsbrianschubert/typing_extensions:coverage-exclusionsCopy head branch name to clipboard
Conversation
Contributor
Author
src/typing_extensions.py
Outdated
|
|
||
| class _Sentinel: | ||
| def __repr__(self): | ||
| def __repr__(self): # pragma: no cover |
Member
There was a problem hiding this comment.
This is fine but maybe we should eat our dogfood and use typing_extensions.Sentinel.
Member
There was a problem hiding this comment.
Or if not, we could also just add a test for this. I know it's trivial code, but it doesn't really do any harm to test it explicitly, and it's nice to keep pragma: no cover exclusions to a minimum.
Contributor
Author
There was a problem hiding this comment.
Dogfooding Sentinel sounds neat - I opened #657 to give that a try
JelleZijlstra
approved these changes
Aug 24, 2025
AlexWaygood
approved these changes
Aug 24, 2025
brianschubert
commented
Aug 24, 2025
JelleZijlstra
approved these changes
Aug 24, 2025
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.
Going through the current test coverage results, there's quite a bit of noise from things that are not expected to be executed or would not be meaningful to test. For example, dummy functions with placeholder bodies:
typing_extensions/src/test_typing_extensions.py
Lines 7788 to 7789 in e589a26
and unexpected error handling:
typing_extensions/src/test_typing_extensions.py
Lines 5958 to 5965 in e589a26
It would be nice to exclude these from the coverage report so that it's easier to see what's actually missing coverage.
This PR adds exclusions for:
passandraise NotImplementedErrorused as placeholder bodies (viapyproject.tomlconfig)# pragma: no covercomments)raise NotImplementedErroror...)if __name__ == '__main__'block in the tests and the__repr__of an internal sentinel