Skip to content

Commit

Permalink
pythongh-109413: Enable mypy's disallow_any_generics setting when c…
Browse files Browse the repository at this point in the history
…hecking `libregrtest` (pythonGH-127033)

(cherry picked from commit 824afbf)

Co-authored-by: sobolevn <[email protected]>
  • Loading branch information
sobolevn authored and miss-islington committed Nov 19, 2024
1 parent bb98a0a commit 13675e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion Lib/test/libregrtest/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/libregrtest/results.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import sys
import trace
from typing import TYPE_CHECKING

from .runtests import RunTests
from .result import State, TestResult, TestStats, Location
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
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 13675e2

Please sign in to comment.