diff --git a/src/trio/_tests/tools/test_mypy_annotate.py b/src/trio/_tests/tools/test_mypy_annotate.py index 1289e2ad4..f733cde48 100644 --- a/src/trio/_tests/tools/test_mypy_annotate.py +++ b/src/trio/_tests/tools/test_mypy_annotate.py @@ -6,7 +6,7 @@ import pytest -from trio._tools.mypy_annotate import Result, export, main, process_line +import trio._tools.mypy_annotate as mypy_annotate if TYPE_CHECKING: from pathlib import Path @@ -19,7 +19,7 @@ ("a regular line\n", None), ( "package\\filename.py:42:8: note: Some info\n", - Result( + mypy_annotate.Result( kind="notice", filename="package\\filename.py", start_line=42, @@ -31,7 +31,7 @@ ), ( "package/filename.py:42:1:46:3: error: Type error here [code]\n", - Result( + mypy_annotate.Result( kind="error", filename="package/filename.py", start_line=42, @@ -43,7 +43,7 @@ ), ( "package/module.py:87: warn: Bad code\n", - Result( + mypy_annotate.Result( kind="warning", filename="package/module.py", start_line=87, @@ -53,14 +53,14 @@ ], ids=["blank", "normal", "note-wcol", "error-wend", "warn-lineonly"], ) -def test_processing(src: str, expected: Result | None) -> None: - result = process_line(src) +def test_processing(src: str, expected: mypy_annotate.Result | None) -> None: + result = mypy_annotate.process_line(src) assert result == expected def test_export(capsys: pytest.CaptureFixture[str]) -> None: results = { - Result( + mypy_annotate.Result( kind="notice", filename="package\\filename.py", start_line=42, @@ -69,7 +69,7 @@ def test_export(capsys: pytest.CaptureFixture[str]) -> None: end_col=None, message=" Some info", ): ["Windows", "Mac"], - Result( + mypy_annotate.Result( kind="error", filename="package/filename.py", start_line=42, @@ -78,14 +78,14 @@ def test_export(capsys: pytest.CaptureFixture[str]) -> None: end_col=3, message=" Type error here [code]", ): ["Linux", "Mac"], - Result( + mypy_annotate.Result( kind="warning", filename="package/module.py", start_line=87, message=" Bad code", ): ["Linux"], } - export(results) + mypy_annotate.export(results) std = capsys.readouterr() assert std.err == "" assert std.out == ( @@ -105,7 +105,6 @@ def test_endtoend( monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], ) -> None: - import trio._tools.mypy_annotate as mypy_annotate inp_text = """\ Mypy begun @@ -128,7 +127,7 @@ def test_endtoend( assert result_file.exists() - main(["--dumpfile", str(result_file)]) + mypy_annotate.main(["--dumpfile", str(result_file)]) std = capsys.readouterr() assert std.err == ""