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
scratch_2.py . [100%]
---------- coverage: platform darwin, python 3.7.6-final-0 -----------
Name Stmts Miss Cover
----------------------------------
scratch_2.py 12 2 83%
Versioning
Coverage.py, version 5.0.4 with C extension
Full documentation is at https://coverage.readthedocs.io
Reacted by zroug, Claudio Jolowicz, Jasha Sommer-Simpson, Michael Cousins, loldebyte, Marvin Vogt, Leonard Crestez, Freya Bruhin, Zeckie, Stephen Randall and 8 more
You can configure coverage.py to ignore the overload functions by adding this to your .coveragerc file:
[report]
exclude_lines =
pragma: not covered
@overload
(You need "pragma: not covered" there to keep the default pragma comment working.)
Perhaps a future version of coverage will know more about typing natively, but this will fix your project for the time-being.
Reacted by mhostetter, Iwan Aucamp, Jasha Sommer-Simpson, Leonard Crestez, Oskari Lehto, Lukas Juhrich, Marcel Wilson, Brian Scholer, Javier Buzzi, Lari Liuhamo and 1 more
Reacted by Bibo-Joshi, Jasha Sommer-Simpson, Adam J. Stewart, Eddie Bergman, James Braza, Aksel Blekastad, Matt Morris, Will Garside, Brian Scholer and Lari Liuhamo
Hi @nedbat thanks for the note, adding @overload to the coverage report exclusions is a great idea, instead of individually marking the lines as no cover.
It'd be great to use this issue to track progress on coverage being able to handle typing.
Reacted by NODA Kai, Maxim Elchugin, Martin Thoma, zroug, Tushar Chandra, Patrick Lannigan, Zeckie and Anton Agestam
Activity
nedbat commentedon Apr 12, 2020
You can configure coverage.py to ignore the overload functions by adding this to your .coveragerc file:
(You need "pragma: not covered" there to keep the default pragma comment working.)
Perhaps a future version of coverage will know more about typing natively, but this will fix your project for the time-being.
adithyabsk commentedon Apr 12, 2020
Hi @nedbat thanks for the note, adding @overload to the coverage report exclusions is a great idea, instead of individually marking the lines as no cover.
It'd be great to use this issue to track progress on coverage being able to handle typing.
The-Compiler commentedon Jan 10, 2023
Would it perhaps make sense to add
@overloadto the defaultexclude_lines? They can't contain any code:I suppose a downside would be that this would also catch
@overloadusage whereoverloadis not actuallytyping.overloadthough.