@@ -516,7 +516,6 @@ def parse_test_failures_from_stdout(test_results: TestResults, stdout: str) -> T
516516 stdout_lines = stdout .splitlines ()
517517 start_line = end_line = None
518518
519- # optimize search for start/end by scanning once
520519 for i , line in enumerate (stdout_lines ):
521520 if start_line is None and "FAILURES" in line :
522521 start_line = i
@@ -534,24 +533,16 @@ def parse_test_failures_from_stdout(test_results: TestResults, stdout: str) -> T
534533 current_test_case : str | None = None
535534 current_failure_lines : list [str ] = []
536535
537- # Avoid per-line string concatenation by tracking indices and performing join once per section
538- # Precompute the boundary check value
539536 underline_prefix = "_______"
540537
541- # Minor: Pull into local variable to avoid attribute lookup inside loop
542- join_nl = "\n " .join
543- append = current_failure_lines .append
544-
545538 for line in complete_failure_output_lines :
546- # Fast-path: avoid .startswith() unless it can possibly match
547539 if line and line [0 ] == "_" and line .startswith (underline_prefix ):
548540 if current_test_case :
549541 test_case_to_failure [current_test_case ] = "" .join (current_failure_lines )
550542 current_test_case = line .strip ("_ " ).strip ()
551- # Start new collection
552543 current_failure_lines .clear ()
553544 elif current_test_case :
554- append (line + "\n " )
545+ current_failure_lines . append (line + "\n " )
555546
556547 if current_test_case :
557548 test_case_to_failure [current_test_case ] = "" .join (current_failure_lines )
0 commit comments