Skip to content

Commit 08b0524

Browse files
committed
Fixed pytest issues
1 parent 9f7b3b2 commit 08b0524

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

commit0/harness/evaluate.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23
import os
34
from collections import Counter
@@ -105,8 +106,18 @@ def main(
105106
}
106107
)
107108
continue
108-
report = load_dataset("json", data_files=report_file, split="train") # type: ignore
109-
tests = {x["nodeid"]: x["call"] for x in report["tests"][0] if "call" in x} # type: ignore
109+
with open(report_file, "r") as file:
110+
report = json.load(file)
111+
# new version of pytest json
112+
if "created" in report:
113+
tests = {x["nodeid"]: x["call"] for x in report["tests"] if "call" in x}
114+
# old version of pytest json
115+
else:
116+
tests = {
117+
x["nodeid"]: {"outcome": x["outcome"], "duration": x["duration"]}
118+
for x in report
119+
if x["when"] == "call"
120+
}
110121
status = []
111122
runtimes = []
112123
no_runs = 0

0 commit comments

Comments
 (0)