Skip to content

Commit

Permalink
chore(coverage): exclude some lines (#338)
Browse files Browse the repository at this point in the history
* exclude some lines from coverage

* chore(coverage): mention `covdefaults` rule provenance

---------

Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
  • Loading branch information
akeeman and mkniewallner authored Apr 23, 2023
1 parent 1077465 commit 3c61806
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ preview = true

[tool.coverage.report]
skip_empty = true
# Subset of rules from https://pypi.org/project/covdefaults/
exclude_lines = [
# a more strict default pragma
"# pragma: no cover\\b",

# allow defensive code
"^\\s*raise AssertionError\\b",
"^\\s*raise NotImplementedError\\b",
"^\\s*return NotImplemented\\b",
"^\\s*raise$",

# typing-related code
"^\\s*if (False|TYPE_CHECKING):",
": \\.\\.\\.(\\s*#.*)?$",
"^ +\\.\\.\\.$",
"-> ['\"]?NoReturn['\"]?:",

# non-runnable code
"if __name__ == ['\"]__main__['\"]:$",
]

[tool.coverage.run]
branch = true
Expand Down

0 comments on commit 3c61806

Please sign in to comment.