Skip to content

Commit

Permalink
[mypy 1.10.0] Remove 'type: ignore' that became useless
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Apr 30, 2024
1 parent 4788165 commit 2b6c946
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/_pytest/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def __eq__(self, actual) -> bool:
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.
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion testing/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ def runtest(self):
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
Expand Down

0 comments on commit 2b6c946

Please sign in to comment.