Skip to content

Commit b4fc642

Browse files
committed
Update for latest inspect-ai xml output
1 parent 1828320 commit b4fc642

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/inspect-ai/utils/scripts/average_results.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,15 @@ def process_pytest_results(attempts_dir: Path) -> Dict[str, Any]:
173173
try:
174174
tree = ET.parse(xml_file)
175175
root = tree.getroot()
176+
node = root.find("testsuite")
177+
178+
assert node is not None, "No `testsuite` element found in XML"
176179

177180
# Extract test metrics from XML
178-
total_tests = int(root.get("tests", 0))
179-
failures = int(root.get("failures", 0))
180-
errors = int(root.get("errors", 0))
181-
skipped = int(root.get("skipped", 0))
181+
total_tests = int(node.get("tests", 0))
182+
failures = int(node.get("failures", 0))
183+
errors = int(node.get("errors", 0))
184+
skipped = int(node.get("skipped", 0))
182185

183186
passed_tests = total_tests - failures - errors - skipped
184187
pass_rate = (passed_tests / total_tests) * 100 if total_tests > 0 else 0

0 commit comments

Comments
 (0)