22# mypy: allow-untyped-defs
33from __future__ import annotations
44
5+ import sys
56import os
67import platform
78import re
89
910# noinspection PyPep8Naming
1011import xml .etree .ElementTree as ET
1112from collections import defaultdict
12- from collections .abc import Callable
13+
14+ if sys .version_info >= (3 , 10 ):
15+ # noinspection PyProtectedMember
16+ from collections import Callable # type: ignore
17+ else :
18+ from collections .abc import Callable
1319from datetime import datetime , timezone
1420
1521import pytest
3036xml_key = StashKey ["LogXML" ]()
3137
3238
39+ # noinspection PyUnresolvedReferences
3340class _NodeReporter :
3441 def __init__ (self , nodeid : str | TestReport , xml : LogXML ) -> None :
3542 self .id = nodeid
@@ -299,6 +306,7 @@ def pytest_configure(config: Config) -> None:
299306
300307 :param config: The pytest Config object containing CLI options and hooks.
301308 """
309+ # noinspection PyUnresolvedReferences
302310 xmldir = config .option .xmldir
303311 if xmldir and not hasattr (config , "workerinput" ):
304312 config .stash [xml_key ] = LogXML (xmldir )
@@ -333,6 +341,7 @@ def mangle_test_address(address: str) -> list[str]:
333341
334342
335343class LogXML :
344+ # noinspection PyUnresolvedReferences
336345 def __init__ ( # type: ignore[no-untyped-def]
337346 self ,
338347 output_dir ,
@@ -350,6 +359,7 @@ def __init__( # type: ignore[no-untyped-def]
350359 self .log_passing_tests = log_passing_tests
351360 self .report_duration = report_duration
352361 self .stats : dict [str , int ] = dict .fromkeys (["error" , "passed" , "failure" , "skipped" ], 0 )
362+ # noinspection PyUnresolvedReferences
353363 self .node_reporters : dict [tuple [str | TestReport , object ], _NodeReporter ] = {}
354364 self .node_reporters_ordered : list [_NodeReporter ] = []
355365
@@ -370,6 +380,7 @@ def finalize(self, report: TestReport) -> None:
370380 reporter .finalize ()
371381
372382 def node_reporter (self , report : TestReport | str ) -> _NodeReporter :
383+ # noinspection PyUnresolvedReferences
373384 nodeid : str | TestReport = getattr (report , "nodeid" , report )
374385 # Local hack to handle xdist report order.
375386 workernode = getattr (report , "node" , None )
0 commit comments