Skip to content

Commit

Permalink
chore: Add ignores for coverage measurement (#61)
Browse files Browse the repository at this point in the history
Ignores `...` placeholders
(nedbat/coveragepy#1616).
Ignores `if TYPE_CHECKING:` because it can never be true at runtime
(nedbat/coveragepy#831).
Ignores branch coverage for `if not TYPE_CHECKING:` because it is always
true at runtime (nedbat/coveragepy#831).
  • Loading branch information
Mr-Pepe committed Oct 25, 2023
1 parent b2c63c3 commit 4aadca1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cookiecutter-pypackage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ branch = true
# Maps coverage measured in site-packages to source files in src
source = ["src/", ".tox/*/lib/python*/site-packages/"]

[tool.coverage.report]
exclude_also = [
"\\.\\.\\.",
"if TYPE_CHECKING:"
]
partial_branches = [
"pragma: no branch",
"if not TYPE_CHECKING:"
]

[tool.coverage.html]
directory = "reports/coverage_html"

Expand Down
10 changes: 10 additions & 0 deletions {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ branch = true
# Maps coverage measured in site-packages to source files in src
source = ["src/", ".tox/*/lib/python*/site-packages/"]

[tool.coverage.report]
exclude_also = [
"\\.\\.\\.",
"if TYPE_CHECKING:"
]
partial_branches = [
"pragma: no branch",
"if not TYPE_CHECKING:"
]

[tool.coverage.html]
directory = "reports/coverage_html"

Expand Down

0 comments on commit 4aadca1

Please sign in to comment.