Skip to content

Commit 824afbf

Browse files
authored
gh-109413: Enable mypy's disallow_any_generics setting when checking libregrtest (#127033)
1 parent 8da9920 commit 824afbf

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Diff for: Lib/test/libregrtest/mypy.ini

-1
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

Diff for: Lib/test/libregrtest/results.py

+5-1
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

Diff for: Lib/test/libregrtest/runtests.py

+1-1
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

Diff for: Lib/test/libregrtest/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

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

2626
cmd = runtests.create_python_cmd()

0 commit comments

Comments
 (0)