Skip to content

Commit

Permalink
Merge pull request #270 from buaabarty/buaabarty/fix-pytestv2-logparse
Browse files Browse the repository at this point in the history
Fix: Skip invalid log lines in pytest_v2 log parser.
  • Loading branch information
john-b-yang authored Dec 10, 2024
2 parents 57ddbc8 + 7afd86f commit 62cd3d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions swebench/harness/log_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ def parse_log_pytest_v2(log: str) -> dict[str, str]:
if line.startswith(TestStatus.FAILED.value):
line = line.replace(" - ", " ")
test_case = line.split()
test_status_map[test_case[1]] = test_case[0]
if len(test_case) >= 2:
test_status_map[test_case[1]] = test_case[0]
# Support older pytest versions by checking if the line ends with the test status
elif any([line.endswith(x.value) for x in TestStatus]):
test_case = line.split()
test_status_map[test_case[0]] = test_case[1]
if len(test_case) >= 2:
test_status_map[test_case[0]] = test_case[1]
return test_status_map


Expand Down

0 comments on commit 62cd3d2

Please sign in to comment.