https://github.com/python/cpython/commit/24b86308f9dc65e6f7bdd5aa040bfa96fa56fa4c
commit: 24b86308f9dc65e6f7bdd5aa040bfa96fa56fa4c
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-11-24T08:40:14Z
summary:

[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 824afbf548e7128ca57c6faf45cfd6b066a6ee45)

Co-authored-by: sobolevn <[email protected]>

files:
M Lib/test/libregrtest/mypy.ini
M Lib/test/libregrtest/results.py
M Lib/test/libregrtest/runtests.py
M Lib/test/libregrtest/worker.py

diff --git a/Lib/test/libregrtest/mypy.ini b/Lib/test/libregrtest/mypy.ini
index 905341cc04b8f1..3fa9afcb7a4a8c 100644
--- a/Lib/test/libregrtest/mypy.ini
+++ b/Lib/test/libregrtest/mypy.ini
@@ -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
diff --git a/Lib/test/libregrtest/results.py b/Lib/test/libregrtest/results.py
index 0e28435bc7d629..53758bf56946f1 100644
--- a/Lib/test/libregrtest/results.py
+++ b/Lib/test/libregrtest/results.py
@@ -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 @@
     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 @@ def __init__(self) -> None:
         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()
 
diff --git a/Lib/test/libregrtest/runtests.py b/Lib/test/libregrtest/runtests.py
index 8e9779524c56a2..3279c1f1aadba7 100644
--- a/Lib/test/libregrtest/runtests.py
+++ b/Lib/test/libregrtest/runtests.py
@@ -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
diff --git a/Lib/test/libregrtest/worker.py b/Lib/test/libregrtest/worker.py
index f8b8e45eca3276..7c801a3cbc15b8 100644
--- a/Lib/test/libregrtest/worker.py
+++ b/Lib/test/libregrtest/worker.py
@@ -17,7 +17,7 @@
 
 
 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()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to