diff --git a/testing/typing_checks.py b/testing/typing_checks.py index ce68ee3e4a5..71d56d64e33 100644 --- a/testing/typing_checks.py +++ b/testing/typing_checks.py @@ -4,10 +4,10 @@ none of the code triggers any mypy errors. """ import contextlib -from typing import assert_type from typing import Optional import pytest +from typing_extensions import assert_type # Issue #7488. @@ -28,8 +28,7 @@ def check_parametrize_ids_callable(func) -> None: pass -def check_raises_is_a_context_manager() -> None: - a: bool - with pytest.raises(RuntimeError) if a else contextlib.nullcontext() as excinfo: +def check_raises_is_a_context_manager(val: bool) -> None: + with pytest.raises(RuntimeError) if val else contextlib.nullcontext() as excinfo: pass assert_type(excinfo, Optional[pytest.ExceptionInfo[RuntimeError]])