Open
Description
Situation
Coverage marks @overload
stubs as uncovered.
# scratch_2.py
from typing import overload, Union
@overload
def some_func(int_or_str: str) -> str:
... # currently marked as uncovered
@overload
def some_func(int_or_str: int) -> int:
... # currently marked as uncovered
def some_func(int_or_str: Union[int, str]) -> Union[int, str]:
return int_or_str
def test_some_func():
assert 10 == some_func(10)
assert "test" == some_func("test")
$ mypy scratch_2.py
$ pytest scratch_2.py --cov=scratch_2 --cov-report=term
Expected results
Full coverage
Current output
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