fix(benchmark): Fix TestResult.fail_reason assignment condition

The condition must be the same as for `success`, because otherwise it causes a crash when `call.excinfo` evaluates to `False` but is not `None`.
This commit is contained in:
Reinier van der Leer
2024-02-16 19:05:00 +01:00
parent 83fcd9ad16
commit 63e6014b27

View File

@@ -90,7 +90,7 @@ def add_test_result_to_report(
TestResult(
success=call.excinfo is None,
run_time=f"{str(round(call.duration, 3))} seconds",
fail_reason=str(call.excinfo.value) if call.excinfo else None,
fail_reason=None if call.excinfo is None else str(call.excinfo.value),
reached_cutoff=user_properties.get("timed_out", False),
n_steps=user_properties.get("n_steps"),
cost=user_properties.get("agent_task_cost"),