MCPcopy Create free account
hub / github.com/FastLED/FastLED / ProcessOutputHandler

Class ProcessOutputHandler

ci/util/test_runner.py:378–528  ·  view source on GitHub ↗

Handles capturing and displaying process output with structured results

Source from the content-addressed store, hash-verified

376
377
378class ProcessOutputHandler:
379 """Handles capturing and displaying process output with structured results"""
380
381 def __init__(self, verbose: bool = False):
382 self.formatter = TestOutputFormatter(verbose=verbose)
383 self.current_command: Optional[str] = None
384 self.header_printed = False
385
386 def handle_output_line(self, line: str, process_name: str) -> None:
387 """Process a line of output and convert it to structured test results"""
388 # Start new test suite if command changes
389 if process_name != self.current_command:
390 if self.current_command:
391 self.formatter.end_suite()
392 self.formatter.start_suite(process_name)
393 self.current_command = process_name
394 self.header_printed = True
395 self.formatter.add_result(
396 TestResult(
397 type=TestResultType.INFO,
398 message=f"=== [{process_name}] ===",
399 test_name=process_name,
400 )
401 )
402
403 # Convert line to appropriate test result
404 result = self._parse_line_to_result(line, process_name)
405 if result:
406 self.formatter.add_result(result)
407
408 def _parse_line_to_result(
409 self, line: str, process_name: str
410 ) -> Optional[TestResult]:
411 """Parse a line of output into a structured test result"""
412 # Skip empty lines
413 if not line.strip():
414 return None
415
416 # Skip test output noise
417 if any(
418 noise in line
419 for noise in [
420 "doctest version is",
421 'run with "--help"',
422 "assertions:",
423 "test cases:",
424 "MESSAGE:",
425 "TEST CASE:",
426 "Test passed",
427 "Test execution",
428 "Test completed",
429 "Running test:",
430 "Process completed:",
431 "Command completed:",
432 "Command output:",
433 "Exit code:",
434 "All parallel tests",
435 "JSON parsing failed",

Callers 1

_run_parallelMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected