Skip to content

Commit

Permalink
Manually fix mypy warnings that appeared because type ignores were mo…
Browse files Browse the repository at this point in the history
…ved around
  • Loading branch information
Pierre-Sassoulas committed Feb 1, 2024
1 parent 29ee247 commit 6ecc15d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/_pytest/unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def _addexcinfo(self, rawexcinfo: "_SysExcInfoType") -> None:
rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo)
try:
excinfo = _pytest._code.ExceptionInfo[BaseException].from_exc_info(

Check warning on line 209 in src/_pytest/unittest.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/unittest.py#L209

Added line #L209 was not covered by tests
rawexcinfo
) # type: ignore[arg-type]
rawexcinfo # type: ignore[arg-type]
)
# Invoke the attributes to trigger storing the traceback
# trial causes some issue there.
excinfo.value
Expand Down
7 changes: 5 additions & 2 deletions testing/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2404,8 +2404,11 @@ def markup(self, word: str, **markup: str):
if msg:
rep.longrepr.reprcrash.message = msg # type: ignore
actual = _get_line_with_reprcrash_message(
config, rep(), DummyTerminalWriter(), {}
) # type: ignore
config, # type: ignore[arg-type]
rep(), # type: ignore[arg-type]
DummyTerminalWriter(), # type: ignore[arg-type]
{},
)

assert actual == expected
if actual != f"{mocked_verbose_word} {mocked_pos}":
Expand Down
4 changes: 2 additions & 2 deletions testing/test_warning_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ def test():
def test_warn_explicit_for_annotates_errors_with_location():
with pytest.raises(Warning, match="(?m)test\n at .*python_api.py:\\d+"):
warning_types.warn_explicit_for(
pytest.raises,
warning_types.PytestWarning("test"), # type: ignore
pytest.raises, # type: ignore[arg-type]
warning_types.PytestWarning("test"),
)

0 comments on commit 6ecc15d

Please sign in to comment.