in 07-eval/conftest.py [0:0]
def pytest_runtest_makereport(item, call):
outcome = yield
if call.when != "call":
return # we don't trace setup and teardown phases
if not (span := getattr(item, "span", None)):
return # test didn't use the traced_test fixture
report = outcome.get_result()
if report.skipped:
return span.set_status(
Status(status_code=StatusCode.UNSET, description="Test skipped")
)
if not report.failed:
return span.set_status(Status(status_code=StatusCode.OK))
span.add_event(
"exception",
attributes={
"exception.type": call.excinfo.type.__name__,
"exception.message": str(call.excinfo.value),
"exception.stacktrace": "".join(
traceback.format_exception(
call.excinfo.type, call.excinfo.value, call.excinfo.tb
)
),
},
)
span.set_status(
Status(
status_code=StatusCode.ERROR, description=str(call.excinfo.value)
)
)