Skip to content

Commit 52b85f6

Browse files
committed
Update mypy 0.720 -> 0.740
Changelogs: http://mypy-lang.blogspot.com/2019/09/mypy-730-released.html http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html New errors: src/_pytest/recwarn.py:77: error: Missing return statement src/_pytest/recwarn.py:185: error: "bool" is invalid as return type for "__exit__" that always returns False src/_pytest/recwarn.py:185: note: Use "typing_extensions.Literal[False]" as the return type or change it to "None" src/_pytest/recwarn.py:185: note: If return type of "__exit__" implies that it may return True, the context manager may swallow exceptions src/_pytest/recwarn.py:185: error: Return type "bool" of "__exit__" incompatible with return type "None" in supertype "catch_warnings" src/_pytest/recwarn.py:230: error: "bool" is invalid as return type for "__exit__" that always returns False src/_pytest/recwarn.py:230: note: Use "typing_extensions.Literal[False]" as the return type or change it to "None" src/_pytest/recwarn.py:230: note: If return type of "__exit__" implies that it may return True, the context manager may swallow exceptions src/_pytest/recwarn.py:230: error: Return type "bool" of "__exit__" incompatible with return type "None" in supertype "catch_warnings" The errors are due to this new error: https://mypy.readthedocs.io/en/latest/error_code_list.html#check-the-return-type-of-exit-exit-return
1 parent c71a2c9 commit 52b85f6

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ repos:
4242
hooks:
4343
- id: rst-backticks
4444
- repo: https://github.com/pre-commit/mirrors-mypy
45-
rev: v0.720
45+
rev: v0.740
4646
hooks:
4747
- id: mypy
4848
files: ^(src/|testing/)

src/_pytest/recwarn.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __exit__(
187187
exc_type: Optional["Type[BaseException]"],
188188
exc_val: Optional[BaseException],
189189
exc_tb: Optional[TracebackType],
190-
) -> bool:
190+
) -> None:
191191
if not self._entered:
192192
__tracebackhide__ = True
193193
raise RuntimeError("Cannot exit %r without entering first" % self)
@@ -198,8 +198,6 @@ def __exit__(
198198
# manually here for this context manager to become reusable.
199199
self._entered = False
200200

201-
return False
202-
203201

204202
class WarningsChecker(WarningsRecorder):
205203
def __init__(
@@ -232,7 +230,7 @@ def __exit__(
232230
exc_type: Optional["Type[BaseException]"],
233231
exc_val: Optional[BaseException],
234232
exc_tb: Optional[TracebackType],
235-
) -> bool:
233+
) -> None:
236234
super().__exit__(exc_type, exc_val, exc_tb)
237235

238236
__tracebackhide__ = True
@@ -263,4 +261,3 @@ def __exit__(
263261
[each.message for each in self],
264262
)
265263
)
266-
return False

0 commit comments

Comments
 (0)