Skip to content

Commit 943dfa8

Browse files
author
Dylan Huang
committed
fix assertion error loggiing
1 parent 690b753 commit 943dfa8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

eval_protocol/pytest/evaluation_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ def _log_eval_error(
471471
try:
472472
# Handle dataset loading
473473
data: List[EvaluationRow] = []
474+
# Track all rows processed in the current run for error logging
475+
processed_rows_in_run: List[EvaluationRow] = []
474476
if "dataset_path" in kwargs and kwargs["dataset_path"] is not None:
475477
ds_arg = kwargs["dataset_path"]
476478
# Support either a single path or a list of paths; if a list is provided,
@@ -584,6 +586,7 @@ def _log_eval_error(
584586
# log the fresh_dataset
585587
for row in fresh_dataset:
586588
active_logger.log(row)
589+
processed_rows_in_run.append(row)
587590

588591
# prepare parallel eval helper function
589592
semaphore = asyncio.Semaphore(max_concurrent_evaluations)
@@ -738,10 +741,16 @@ async def _collect_result(config, lst):
738741
)
739742

740743
except AssertionError:
741-
_log_eval_error("finished", data if "data" in locals() else None, passed=False)
744+
_log_eval_error(
745+
"finished",
746+
processed_rows_in_run if "processed_rows_in_run" in locals() else None,
747+
passed=False,
748+
)
742749
raise
743750
except Exception:
744-
_log_eval_error("error", data if "data" in locals() else None, passed=False)
751+
_log_eval_error(
752+
"error", processed_rows_in_run if "processed_rows_in_run" in locals() else None, passed=False
753+
)
745754
raise
746755

747756
return create_dynamically_parameterized_wrapper(test_func, wrapper_body, test_param_names)

0 commit comments

Comments
 (0)