10
10
import threading
11
11
import time
12
12
import traceback
13
- from typing import Literal , TextIO
13
+ from typing import Any , Literal , TextIO
14
14
15
15
from test import support
16
16
from test .support import os_helper , MS_WINDOWS
@@ -243,7 +243,9 @@ def create_json_file(self, stack: contextlib.ExitStack) -> tuple[JsonFile, TextI
243
243
244
244
json_fd = json_tmpfile .fileno ()
245
245
if MS_WINDOWS :
246
- json_handle = msvcrt .get_osfhandle (json_fd )
246
+ # The msvcrt module is only available on Windows;
247
+ # we run mypy with `--platform=linux` in CI
248
+ json_handle : int = msvcrt .get_osfhandle (json_fd ) # type: ignore[attr-defined]
247
249
json_file = JsonFile (json_handle ,
248
250
JsonFileType .WINDOWS_HANDLE )
249
251
else :
@@ -257,7 +259,7 @@ def create_worker_runtests(self, test_name: TestName, json_file: JsonFile) -> Wo
257
259
else :
258
260
match_tests = None
259
261
260
- kwargs = {}
262
+ kwargs : dict [ str , Any ] = {}
261
263
if match_tests :
262
264
kwargs ['match_tests' ] = [(test , True ) for test in match_tests ]
263
265
if self .runtests .output_on_failure :
@@ -343,6 +345,7 @@ def _runtest(self, test_name: TestName) -> MultiprocessResult:
343
345
json_file , json_tmpfile = self .create_json_file (stack )
344
346
worker_runtests = self .create_worker_runtests (test_name , json_file )
345
347
348
+ retcode : str | int | None
346
349
retcode , tmp_files = self .run_tmp_files (worker_runtests ,
347
350
stdout_file .fileno ())
348
351
0 commit comments