Commit 53f605c6 authored by Jan Kiene's avatar Jan Kiene
Browse files

add debug output into makereport hook

parent 3ce1cf5f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -463,9 +463,23 @@ def pytest_runtest_makereport(item, call):
    # Use hook to catch exceptions
    outcome = yield
    report = outcome.get_result()

    print(
        f"[PYTEST_RUNTEST_MAKEREPORT] when={report.when}, outcome={report.outcome}, excinfo={call.excinfo is not None}",
        file=sys.stderr,
    )

    test_info = item.funcargs.get("test_info", None)

    print(
        f"[PYTEST_RUNTEST_MAKEREPORT] test_info={test_info}, test_info in funcargs={test_info is not None}",
        file=sys.stderr,
    )

    if call.excinfo is not None and report.when == "call":
        print(
            f"[PYTEST_RUNTEST_MAKEREPORT] exc_type={call.excinfo.type}", file=sys.stderr
        )
        # Make sure exception is not due to a skipped or failed test (allowed exceptions)
        type = call.excinfo.type
        xfail = hasattr(report, "wasxfail")