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>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
55c2746569
commit
d4ea2eef61
@@ -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]:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user