From d4ea2eef619b55a29205df4101fc053f00b96128 Mon Sep 17 00:00:00 2001 From: Emil Simeonov Date: Sat, 20 Jun 2026 21:06:41 +0200 Subject: [PATCH] fix: parse pytest output with warnings in check_test_speed The regex only matched "N passed in X.XXs" but pytest can output "N passed, M warnings in X.XXs". Updated regex to handle both. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- scripts/check_test_speed.py | 2 +- tests/unit/test_check_test_speed.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/check_test_speed.py b/scripts/check_test_speed.py index 455fbb5..668b885 100644 --- a/scripts/check_test_speed.py +++ b/scripts/check_test_speed.py @@ -16,7 +16,7 @@ from gitea_runner_manager.i18n import _ DEFAULT_MAX_SECONDS = 2.0 TEST_COMMAND = ["make", "test-unit"] -_TIMING_RE = re.compile(r"(\d+) passed in ([0-9.]+)s") +_TIMING_RE = re.compile(r"(\d+) passed.* in ([0-9.]+)s") def run_tests() -> tuple[str, str]: diff --git a/tests/unit/test_check_test_speed.py b/tests/unit/test_check_test_speed.py index 1918e57..af62214 100644 --- a/tests/unit/test_check_test_speed.py +++ b/tests/unit/test_check_test_speed.py @@ -35,6 +35,9 @@ class TestParseDuration: def test_parses_valid_line(self) -> None: assert parse_duration("234 passed in 0.70s") == 0.70 + def test_parses_with_warnings(self) -> None: + assert parse_duration("293 passed, 1 warning in 0.45s") == 0.45 + def test_parses_multiline_output(self) -> None: output = "some header\n234 passed in 1.23s\nfooter" assert parse_duration(output) == 1.23