]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libreg...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 24 Nov 2024 08:40:14 +0000 (09:40 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Nov 2024 08:40:14 +0000 (08:40 +0000)
gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest` (GH-127033)
(cherry picked from commit 824afbf548e7128ca57c6faf45cfd6b066a6ee45)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/libregrtest/mypy.ini
Lib/test/libregrtest/results.py
Lib/test/libregrtest/runtests.py
Lib/test/libregrtest/worker.py

index 905341cc04b8f19d8f7a2b9828bee78dd3f0646e..3fa9afcb7a4a8c3d452e715ef11aa62c4b581fb2 100644 (file)
@@ -15,7 +15,6 @@ strict = True
 
 # Various stricter settings that we can't yet enable
 # Try to enable these in the following order:
-disallow_any_generics = False
 disallow_incomplete_defs = False
 disallow_untyped_calls = False
 disallow_untyped_defs = False
index 0e28435bc7d62959f00be1b4f98424ead89d4dcb..53758bf56946f109c5abc19a1f21d27e706031e9 100644 (file)
@@ -1,5 +1,6 @@
 import sys
 import trace
+from typing import TYPE_CHECKING
 
 from .runtests import RunTests
 from .result import State, TestResult, TestStats, Location
@@ -7,6 +8,9 @@ from .utils import (
     StrPath, TestName, TestTuple, TestList, FilterDict,
     printlist, count, format_duration)
 
+if TYPE_CHECKING:
+    from xml.etree.ElementTree import Element
+
 
 # Python uses exit code 1 when an exception is not caught
 # argparse.ArgumentParser.error() uses exit code 2
@@ -34,7 +38,7 @@ class TestResults:
         self.test_times: list[tuple[float, TestName]] = []
         self.stats = TestStats()
         # used by --junit-xml
-        self.testsuite_xml: list = []
+        self.testsuite_xml: list['Element'] = []
         # used by -T with -j
         self.covered_lines: set[Location] = set()
 
index 8e9779524c56a2f245f89012b5acb7995e02e4e6..3279c1f1aadba7241c6dd3e407ad35eaa59d4872 100644 (file)
@@ -28,7 +28,7 @@ class JsonFile:
     file: int | None
     file_type: str
 
-    def configure_subprocess(self, popen_kwargs: dict) -> None:
+    def configure_subprocess(self, popen_kwargs: dict[str, Any]) -> None:
         match self.file_type:
             case JsonFileType.UNIX_FD:
                 # Unix file descriptor
index f8b8e45eca327682d877c9292bbf377c8a6cfab2..7c801a3cbc15b843caf0837343c30f2d2bd2caee 100644 (file)
@@ -17,7 +17,7 @@ USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))
 
 
 def create_worker_process(runtests: WorkerRunTests, output_fd: int,
-                          tmp_dir: StrPath | None = None) -> subprocess.Popen:
+                          tmp_dir: StrPath | None = None) -> subprocess.Popen[str]:
     worker_json = runtests.as_json()
 
     cmd = runtests.create_python_cmd()