Skip to content

Commit 84484c7

Browse files
committed
fix(coverage): make the gate mean the same on every Python
A type checking block never runs, and Python 3.14 drops it before coverage can see it while 3.12 and 3.13 count it as a statement that never executes. The gate therefore passed on the newest runtime and failed on the oldest supported one, which is the worst of both. The same split applies to a protocol method whose body is an ellipsis.
1 parent 8f2bf5d commit 84484c7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ exclude_also = [
103103
# there is nothing behind it left to exercise. Importing the module to cover
104104
# the guard would run the tool rather than test it.
105105
'if __name__ == "__main__":',
106+
# A type checking block never runs, by definition. Python 3.14 drops it before
107+
# coverage can see it and earlier versions do not, so leaving it in would make
108+
# the gate mean one thing on the newest runtime and another on the oldest
109+
# supported one, which is worse than either.
110+
'if TYPE_CHECKING:',
111+
# A protocol method has no body to run, whether the ellipsis sits on its own
112+
# line or after the signature. The same version split applies.
113+
'^\s*\.\.\.$',
114+
': \.\.\.$',
106115
]
107116

108117
[tool.mypy]

0 commit comments

Comments
 (0)