Skip to content

Commit 4da0689

Browse files
committed
Ignore mypy error about missing generic arg for catch_warnings
mypy stubs recently changed warnings.catch_warnings to a Generic, in order to have proper overloads depending on the parameters passed to it, whihc triggers this mypy error now when we subclass it: src/_pytest/recwarn.py:170: error: Missing type parameters for generic type "catch_warnings" [type-arg] For our porpuses the parameter is not relevant (we always use record=True), so decided to just ignore the type error.
1 parent 4ee6e90 commit 4da0689

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
default_language_version:
2+
python: "3.10"
13
repos:
24
- repo: https://github.com/psf/black
35
rev: 22.8.0

src/_pytest/recwarn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def warns( # noqa: F811
167167
return func(*args[1:], **kwargs)
168168

169169

170-
class WarningsRecorder(warnings.catch_warnings):
170+
class WarningsRecorder(warnings.catch_warnings): # type:ignore[type-arg]
171171
"""A context manager to record raised warnings.
172172
173173
Each recorded warning is an instance of :class:`warnings.WarningMessage`.

0 commit comments

Comments
 (0)