Skip to content

Protocol method placeholders marked as untested #593

Closed as not planned
Closed as not planned

Description

@andrewlalis

Summary

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.

Versions

python version 3.11
pytest version 7.3.0
pytest-cov version 4.0.0

Code

from typing import Protocol

class Example(Protocol):
    def do_something() -> None:
        ...

In the above code, the line containing ... is marked as untested, despite the fact that it cannot, by definition, be tested because protocols cannot be implemented directly.

Activity

  1. RonnyPfannschmidt commented on May 1, 2023

    @RonnyPfannschmidt
    Member

    As far as Coverage is concerned, they never executed, i believe this would also happen with vanilla coverage.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions