Process active tests, return True if any activity occurred.
(
self,
active_processes: list[RunningProcess],
exit_failed_processes: list[tuple[RunningProcess, int]],
failed_processes: list[str],
completed_timings: list[ProcessTiming],
stuck_monitor: Optional[ProcessStuckMonitor],
)
| 557 | return failures |
| 558 | |
| 559 | def _process_active_tests( |
| 560 | self, |
| 561 | active_processes: list[RunningProcess], |
| 562 | exit_failed_processes: list[tuple[RunningProcess, int]], |
| 563 | failed_processes: list[str], |
| 564 | completed_timings: list[ProcessTiming], |
| 565 | stuck_monitor: Optional[ProcessStuckMonitor], |
| 566 | ) -> bool: |
| 567 | """Process active tests, return True if any activity occurred.""" |
| 568 | any_activity = False |
| 569 | |
| 570 | # Iterate backwards to safely remove processes from the list |
| 571 | for i in range(len(active_processes) - 1, -1, -1): |
| 572 | proc = active_processes[i] |
| 573 | |
| 574 | if self.config.verbose: |
| 575 | with proc.line_iter(timeout=60) as line_iter: |
| 576 | for line in line_iter: |
| 577 | print(line) |
| 578 | any_activity = True |
| 579 | |
| 580 | # Check if process has finished |
| 581 | if proc.finished: |
| 582 | any_activity = True |
| 583 | # Get the exit code to check for failure |
| 584 | exit_code = cast(int, proc.wait()) |
| 585 | |
| 586 | # Process completed, remove from active list |
| 587 | active_processes.remove(proc) |
| 588 | # Stop monitoring this process |
| 589 | if stuck_monitor: |
| 590 | stuck_monitor.stop_monitoring(proc) |
| 591 | |
| 592 | # Collect timing data |
| 593 | if proc.duration is not None: |
| 594 | timing = ProcessTiming( |
| 595 | name=_get_friendly_test_name(proc.command), |
| 596 | duration=proc.duration, |
| 597 | command=str(proc.command), |
| 598 | ) |
| 599 | completed_timings.append(timing) |
| 600 | |
| 601 | # Check for non-zero exit code (failure) |
| 602 | if exit_code != 0: |
| 603 | print( |
| 604 | f"Process failed with exit code {exit_code}: {proc.command}", |
| 605 | flush=True, |
| 606 | ) |
| 607 | exit_failed_processes.append((proc, exit_code)) |
| 608 | # Early abort if we reached the failure threshold |
| 609 | if ( |
| 610 | len(exit_failed_processes) + len(failed_processes) |
| 611 | ) >= self.config.max_failures_before_abort: |
| 612 | print( |
| 613 | f"\nExceeded failure threshold ({self.config.max_failures_before_abort}). Aborting remaining tests." |
| 614 | ) |
| 615 | # Kill remaining active processes |
| 616 | for p in active_processes: |
no test coverage detected