diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 7d89fdd80..9b17e5cb7 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -454,7 +454,7 @@ class ApproxScalar(ApproxBase): return False # Return true if the two numbers are within the tolerance. - result: bool = abs(self.expected - actual) <= self.tolerance # type: ignore[arg-type] + result: bool = abs(self.expected - actual) <= self.tolerance return result # Ignore type because of https://github.com/python/mypy/issues/4266. diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index eb444f2e3..5b7cd3e1d 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -167,7 +167,7 @@ def pytest_runtest_call(item: Item) -> None: del sys.last_value del sys.last_traceback if sys.version_info >= (3, 12, 0): - del sys.last_exc # type: ignore[attr-defined] + del sys.last_exc except AttributeError: pass try: @@ -177,7 +177,7 @@ def pytest_runtest_call(item: Item) -> None: sys.last_type = type(e) sys.last_value = e if sys.version_info >= (3, 12, 0): - sys.last_exc = e # type: ignore[attr-defined] + sys.last_exc = e assert e.__traceback__ is not None # Skip *this* frame sys.last_traceback = e.__traceback__.tb_next diff --git a/testing/test_runner.py b/testing/test_runner.py index ecb98f2ff..6bd4a045d 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -1032,7 +1032,7 @@ def test_store_except_info_on_error() -> None: assert sys.last_type is IndexError assert isinstance(sys.last_value, IndexError) if sys.version_info >= (3, 12, 0): - assert isinstance(sys.last_exc, IndexError) # type: ignore[attr-defined] + assert isinstance(sys.last_exc, IndexError) assert sys.last_value.args[0] == "TEST" assert sys.last_traceback