fix(benchmark): Improve output and debug logging of pytest evals

This commit is contained in:
Reinier van der Leer
2024-05-30 17:16:17 +02:00
parent f107ff8cf0
commit 738c8ffff0

View File

@@ -339,8 +339,11 @@ class BuiltinChallenge(BaseChallenge):
capture_output=True,
text=True,
)
logger.debug(f"EXIT CODE: {result.returncode}")
logger.debug(f"STDOUT: {result.stdout}")
logger.debug(f"STDERR: {result.stderr}")
if "error" in result.stderr or result.returncode != 0:
yield "pytest", f"Error: {result.stderr}\n"
yield "pytest", f"Error: {result.stderr.strip() or result.stdout}\n"
else:
yield "pytest", f"Output: {result.stdout}\n"