Unverified Commit 1da9325a authored by norvell's avatar norvell
Browse files

Try report.when setting for error reporting

parent bf00f41c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -453,11 +453,6 @@ def dut_encoder_path(request) -> str:
def test_info(request):
    yield request

    # Check for errors during teardown to report error instead of failure
    if hasattr(request, "error"):
        pytest.fail(request.error)


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
    # Use hook to catch exceptions
@@ -472,6 +467,8 @@ def pytest_runtest_makereport(item, call):
        if type not in [Skipped, Failed] and not xfail:
            # Capture exception in test_info
            test_info.error = str(call.excinfo.value)
            # Mark as error for both pytest-html and junit-xml
            report.when = "teardown"


@pytest.fixture(scope="session")