| 395 | |
| 396 | |
| 397 | def parse_summary(log_path: pathlib.Path) -> tuple[int, int, int] | None: |
| 398 | try: |
| 399 | stream = log_path.open(encoding="utf-8", errors="replace") |
| 400 | except OSError as exc: |
| 401 | raise RuntimeError(f"cannot read suite log {log_path}: {exc}") from exc |
| 402 | last_summary = None |
| 403 | with stream: |
| 404 | for line in stream: |
| 405 | match = SUMMARY.match(line) |
| 406 | if match is None: |
| 407 | continue |
| 408 | failed = FAILED.search(line) |
| 409 | skipped = SKIPPED.search(line) |
| 410 | last_summary = ( |
| 411 | int(match.group("passed")), |
| 412 | int(failed.group("failed")) if failed is not None else 0, |
| 413 | int(skipped.group("skipped")) if skipped is not None else 0, |
| 414 | ) |
| 415 | return last_summary |
| 416 | |
| 417 | |
| 418 | def count_pass_markers(log_path: pathlib.Path) -> int: |