diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9a970ca7..8481848f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,7 @@ repos: hooks: - id: rst-backticks - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.720 + rev: v0.740 hooks: - id: mypy files: ^(src/|testing/) diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 58076d66b..4967106d9 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -187,7 +187,7 @@ class WarningsRecorder(warnings.catch_warnings): exc_type: Optional["Type[BaseException]"], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], - ) -> bool: + ) -> None: if not self._entered: __tracebackhide__ = True raise RuntimeError("Cannot exit %r without entering first" % self) @@ -198,8 +198,6 @@ class WarningsRecorder(warnings.catch_warnings): # manually here for this context manager to become reusable. self._entered = False - return False - class WarningsChecker(WarningsRecorder): def __init__( @@ -232,7 +230,7 @@ class WarningsChecker(WarningsRecorder): exc_type: Optional["Type[BaseException]"], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], - ) -> bool: + ) -> None: super().__exit__(exc_type, exc_val, exc_tb) __tracebackhide__ = True @@ -263,4 +261,3 @@ class WarningsChecker(WarningsRecorder): [each.message for each in self], ) ) - return False