Skip to content

Commit

Permalink
Don't count protocols in test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
meshy committed May 19, 2024
1 parent 73d5db1 commit 497ebb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cbv/importer/importers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)


class CodeImporter(Protocol):
class CodeImporter(Protocol): # nocoverage: protocol
def generate_code_data(self) -> Iterator[CodeElement]: ...


Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dynamic_context = "test_function"
[tool.coverage.report]
show_missing = true
skip_covered = true
exclude_lines = [
# Protocol classes are abstract, and don't need coverage.
"nocoverage: protocol",
]

[tool.coverage.html]
show_contexts = true
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .factories import KlassFactory, ProjectVersionFactory


class AssertNumQueriesFixture(Protocol):
class AssertNumQueriesFixture(Protocol): # nocoverage: protocol
def __call__(self, num: int, exact: bool = True) -> CaptureQueriesContext: ...


Expand Down

0 comments on commit 497ebb0

Please sign in to comment.