Skip to content

Commit 24b8630

Browse files
[3.13] gh-109413: Enable mypy's disallow_any_generics setting when checking libregrtest (GH-127033) (#127034)
gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest` (GH-127033) (cherry picked from commit 824afbf) Co-authored-by: sobolevn <[email protected]>
1 parent 69472a5 commit 24b8630

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Lib/test/libregrtest/mypy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ strict = True
1515

1616
# Various stricter settings that we can't yet enable
1717
# Try to enable these in the following order:
18-
disallow_any_generics = False
1918
disallow_incomplete_defs = False
2019
disallow_untyped_calls = False
2120
disallow_untyped_defs = False

Lib/test/libregrtest/results.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import sys
22
import trace
3+
from typing import TYPE_CHECKING
34

45
from .runtests import RunTests
56
from .result import State, TestResult, TestStats, Location
67
from .utils import (
78
StrPath, TestName, TestTuple, TestList, FilterDict,
89
printlist, count, format_duration)
910

11+
if TYPE_CHECKING:
12+
from xml.etree.ElementTree import Element
13+
1014

1115
# Python uses exit code 1 when an exception is not caught
1216
# argparse.ArgumentParser.error() uses exit code 2
@@ -34,7 +38,7 @@ def __init__(self) -> None:
3438
self.test_times: list[tuple[float, TestName]] = []
3539
self.stats = TestStats()
3640
# used by --junit-xml
37-
self.testsuite_xml: list = []
41+
self.testsuite_xml: list['Element'] = []
3842
# used by -T with -j
3943
self.covered_lines: set[Location] = set()
4044

Lib/test/libregrtest/runtests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class JsonFile:
2828
file: int | None
2929
file_type: str
3030

31-
def configure_subprocess(self, popen_kwargs: dict) -> None:
31+
def configure_subprocess(self, popen_kwargs: dict[str, Any]) -> None:
3232
match self.file_type:
3333
case JsonFileType.UNIX_FD:
3434
# Unix file descriptor

Lib/test/libregrtest/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
def create_worker_process(runtests: WorkerRunTests, output_fd: int,
20-
tmp_dir: StrPath | None = None) -> subprocess.Popen:
20+
tmp_dir: StrPath | None = None) -> subprocess.Popen[str]:
2121
worker_json = runtests.as_json()
2222

2323
cmd = runtests.create_python_cmd()

0 commit comments

Comments
 (0)