-
-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Originally posted in pytest-cov as issue 593
Describe the bug
When computing the coverage of a project, I am getting cases where the placeholder body of a protocol method is considered as untested code. I would expect that the body of protocol methods would not be marked as untested.
To Reproduce
Consider the following python code:
from typing import Protocol
class Example(Protocol):
def do_something() -> None:
...Using:
- Python version 3.11
- pytest version 7.3.0
- pytest-cov version 4.0.0
- coverage version 7.2.2
Running coverage on a project containing the above Example protocol will produce a report indicating that the line containing the ... placeholder is untested. I believe that this is incorrect, as it is impossible and useless to test the existence of a placeholder statement in a protocol's method definition.
Expected behavior
I would expect coverage to omit marking the lines in the above code snippet as untested.
Additional context
PEP 544 - Protocols