mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[BE][Easy] enable postponed annotations in tools
(#129375)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129375 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
58f346c874
commit
8a67daf283
@ -1,8 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from typing import Any, List, Union
|
||||
from typing import Any
|
||||
|
||||
|
||||
try:
|
||||
from junitparser import ( # type: ignore[import]
|
||||
@ -23,8 +26,8 @@ except ImportError:
|
||||
print("rich not found, for color output use 'pip install rich'")
|
||||
|
||||
|
||||
def parse_junit_reports(path_to_reports: str) -> List[TestCase]: # type: ignore[no-any-unimported]
|
||||
def parse_file(path: str) -> List[TestCase]: # type: ignore[no-any-unimported]
|
||||
def parse_junit_reports(path_to_reports: str) -> list[TestCase]: # type: ignore[no-any-unimported]
|
||||
def parse_file(path: str) -> list[TestCase]: # type: ignore[no-any-unimported]
|
||||
try:
|
||||
return convert_junit_to_testcases(JUnitXml.fromfile(path))
|
||||
except Exception as err:
|
||||
@ -46,7 +49,7 @@ def parse_junit_reports(path_to_reports: str) -> List[TestCase]: # type: ignore
|
||||
return ret_xml
|
||||
|
||||
|
||||
def convert_junit_to_testcases(xml: Union[JUnitXml, TestSuite]) -> List[TestCase]: # type: ignore[no-any-unimported]
|
||||
def convert_junit_to_testcases(xml: JUnitXml | TestSuite) -> list[TestCase]: # type: ignore[no-any-unimported]
|
||||
testcases = []
|
||||
for item in xml:
|
||||
if isinstance(item, TestSuite):
|
||||
@ -56,7 +59,7 @@ def convert_junit_to_testcases(xml: Union[JUnitXml, TestSuite]) -> List[TestCase
|
||||
return testcases
|
||||
|
||||
|
||||
def render_tests(testcases: List[TestCase]) -> None: # type: ignore[no-any-unimported]
|
||||
def render_tests(testcases: list[TestCase]) -> None: # type: ignore[no-any-unimported]
|
||||
num_passed = 0
|
||||
num_skipped = 0
|
||||
num_failed = 0
|
||||
|
Reference in New Issue
Block a user