Loading tests/conftest.py +7 −11 Original line number Diff line number Diff line Loading @@ -453,25 +453,21 @@ 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 outcome = yield report = outcome.get_result() test_info = item.funcargs.get("test_info", None) if call.excinfo is not None and report.when == "call": # Make sure exception is not due to a skipped or failed test (allowed exceptions) type = call.excinfo.type exc_type = call.excinfo.type xfail = hasattr(report, "wasxfail") if type not in [Skipped, Failed] and not xfail: # Capture exception in test_info test_info.error = str(call.excinfo.value) if exc_type not in [Skipped, Failed] and not xfail: # pytest-html v4 (_is_error in basereport.py) only shows "Error" when # report.when is "setup", "teardown", or "collect" — never for "call". # Reclassify this call-phase crash as a setup-phase error so the HTML # report shows ERROR instead of FAILURE. report.when = "setup" @pytest.fixture(scope="session") Loading Loading
tests/conftest.py +7 −11 Original line number Diff line number Diff line Loading @@ -453,25 +453,21 @@ 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 outcome = yield report = outcome.get_result() test_info = item.funcargs.get("test_info", None) if call.excinfo is not None and report.when == "call": # Make sure exception is not due to a skipped or failed test (allowed exceptions) type = call.excinfo.type exc_type = call.excinfo.type xfail = hasattr(report, "wasxfail") if type not in [Skipped, Failed] and not xfail: # Capture exception in test_info test_info.error = str(call.excinfo.value) if exc_type not in [Skipped, Failed] and not xfail: # pytest-html v4 (_is_error in basereport.py) only shows "Error" when # report.when is "setup", "teardown", or "collect" — never for "call". # Reclassify this call-phase crash as a setup-phase error so the HTML # report shows ERROR instead of FAILURE. report.when = "setup" @pytest.fixture(scope="session") Loading