Skip to content

Commit 2c45d72

Browse files
Manually fix mypy warnings that appeared because type ignores were moved around
1 parent 5361ce0 commit 2c45d72

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/_pytest/unittest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ def _addexcinfo(self, rawexcinfo: "_SysExcInfoType") -> None:
205205
rawexcinfo = getattr(rawexcinfo, "_rawexcinfo", rawexcinfo)
206206
try:
207207
excinfo = _pytest._code.ExceptionInfo[BaseException].from_exc_info(
208-
rawexcinfo
209-
) # type: ignore[arg-type]
208+
rawexcinfo # type: ignore[arg-type]
209+
)
210210
# Invoke the attributes to trigger storing the traceback
211211
# trial causes some issue there.
212212
excinfo.value

testing/test_terminal.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,8 +2400,11 @@ def markup(self, word: str, **markup: str):
24002400
if msg:
24012401
rep.longrepr.reprcrash.message = msg # type: ignore
24022402
actual = _get_line_with_reprcrash_message(
2403-
config, rep(), DummyTerminalWriter(), {}
2404-
) # type: ignore
2403+
config, # type: ignore[arg-type]
2404+
rep(), # type: ignore[arg-type]
2405+
DummyTerminalWriter(), # type: ignore[arg-type]
2406+
{},
2407+
)
24052408

24062409
assert actual == expected
24072410
if actual != f"{mocked_verbose_word} {mocked_pos}":

testing/test_warning_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ def test():
4343
def test_warn_explicit_for_annotates_errors_with_location():
4444
with pytest.raises(Warning, match="(?m)test\n at .*python_api.py:\\d+"):
4545
warning_types.warn_explicit_for(
46-
pytest.raises,
47-
warning_types.PytestWarning("test"), # type: ignore
46+
pytest.raises, # type: ignore[arg-type]
47+
warning_types.PytestWarning("test"),
4848
)

0 commit comments

Comments
 (0)