88import pathlib
99import platform
1010import sys
11- from typing import Dict , List , Optional
11+ from typing import Dict , List
1212
1313from defusedxml .ElementTree import parse
1414
@@ -66,30 +66,9 @@ def create_argument_parser() -> argparse.ArgumentParser:
6666 default = 'all' ,
6767 help = 'name of the test suite, default: %(default)s' ,
6868 )
69- argument_parser .add_argument (
70- '--skip-list' ,
71- type = str ,
72- help = 'an exclude list dir used in pass rate calculation' ,
73- )
7469 return argument_parser
7570
7671
77- def get_deselected (report_path : pathlib .Path , skiplist_dir : pathlib .Path ) -> int :
78- """Calculates deselected (via skiplist) tests."""
79- skiplist_path = skiplist_dir / f'{ report_path .stem } .txt'
80- if not skiplist_path .exists ():
81- return 0
82- with skiplist_path .open ('r' ) as f :
83- count = 0
84- for line in f .readlines ():
85- # `strip` allows to skip lines with only '\n' character
86- line = line .strip ()
87- # skip empty lines and comments
88- if line and not line .startswith ('#' ):
89- count += 1
90- return count
91-
92-
9372def get_warnings (reports_path : pathlib .Path , suite : str ) -> List [TestWarning ]:
9473 """Returns a list of warnings for the specified suite."""
9574 path = reports_path / f'{ suite } -warnings.json'
@@ -101,10 +80,10 @@ def get_warnings(reports_path: pathlib.Path, suite: str) -> List[TestWarning]:
10180
10281
10382def get_missing_tests (warnings : List [TestWarning ]) -> List [str ]:
104- """Searches warnings for PytestSelectWarning and returns a list of missing tests."""
83+ """Searches warnings for UserWarning and returns a list of missing tests."""
10584 tests = set ()
10685 for warning in warnings :
107- if 'PytestSelectWarning : pytest-select : Not all deselected' not in warning .message :
86+ if 'UserWarning : pytest-skip : Not all deselected' not in warning .message :
10887 continue
10988 for line in warning .message .splitlines ():
11089 if line .startswith (' - ' ):
@@ -124,7 +103,7 @@ def get_all_missing_tests(reports_path: pathlib.Path) -> Dict[str, List[str]]:
124103 return all_missing_tests
125104
126105
127- def parse_report (report_path : pathlib .Path , skiplist_dir : Optional [ pathlib . Path ] ) -> ReportStats :
106+ def parse_report (report_path : pathlib .Path ) -> ReportStats :
128107 """Parses the specified report."""
129108 stats = ReportStats (name = report_path .stem )
130109 root = parse (report_path ).getroot ()
@@ -145,13 +124,6 @@ def parse_report(report_path: pathlib.Path, skiplist_dir: Optional[pathlib.Path]
145124 testsuite_fixme_tests .add (warning .location )
146125 stats .fixme += len (testsuite_fixme_tests )
147126
148- test_unskip = os .getenv ('TEST_UNSKIP' , 'false' )
149- if test_unskip not in ('true' , 'false' ):
150- raise ValueError ('Error: please set TEST_UNSKIP true or false' )
151- if skiplist_dir and test_unskip == 'false' :
152- deselected = get_deselected (report_path , skiplist_dir )
153- stats .skipped += deselected
154- stats .total += deselected
155127 stats .passed = stats .total - stats .failed - stats .skipped - stats .xfailed
156128 return stats
157129
@@ -180,7 +152,7 @@ def find_stats(stats: List[ReportStats], name: str) -> ReportStats:
180152def parse_junit_reports (args : argparse .Namespace ) -> List [ReportStats ]:
181153 """Parses junit report in the specified directory."""
182154 reports_path = pathlib .Path (args .reports )
183- return [parse_report (report , args . skiplist_dir ) for report in reports_path .glob ('*.xml' )]
155+ return [parse_report (report ) for report in reports_path .glob ('*.xml' )]
184156
185157
186158def parse_tutorials_reports (args : argparse .Namespace ) -> List [ReportStats ]:
@@ -248,10 +220,6 @@ def main():
248220 """Main."""
249221 args = create_argument_parser ().parse_args ()
250222 args .report_path = pathlib .Path (args .reports )
251- if args .skip_list :
252- args .skiplist_dir = pathlib .Path (args .skip_list )
253- else :
254- args .skiplist_dir = None
255223
256224 missing_tests = get_all_missing_tests (args .report_path )
257225 if missing_tests :
0 commit comments