Skip to content

Commit f2148e2

Browse files
committed
trying codeflash version
1 parent dddc6c8 commit f2148e2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

codeflash/models/models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,19 +537,20 @@ def report_to_tree(report: dict[TestType, dict[str, int]], title: str) -> Tree:
537537
return tree
538538

539539
def usable_runtime_data_by_test_case(self) -> dict[InvocationId, list[int]]:
540-
usable_id_to_runtime = defaultdict(list)
540+
# Efficient single traversal, directly accumulating into a dict.
541+
by_id: dict[InvocationId, list[int]] = {}
541542
for result in self.test_results:
542543
if result.did_pass:
543-
if not result.runtime:
544+
if result.runtime:
545+
by_id.setdefault(result.id, []).append(result.runtime)
546+
else:
544547
msg = (
545548
f"Ignoring test case that passed but had no runtime -> {result.id}, "
546549
f"Loop # {result.loop_index}, Test Type: {result.test_type}, "
547550
f"Verification Type: {result.verification_type}"
548551
)
549552
logger.debug(msg)
550-
else:
551-
usable_id_to_runtime[result.id].append(result.runtime)
552-
return usable_id_to_runtime
553+
return by_id
553554

554555
def total_passed_runtime(self) -> int:
555556
"""Calculate the sum of runtimes of all test cases that passed.

0 commit comments

Comments
 (0)