From e4da465b21c4a16b7d7b2fcbb6a7e50aeb0d72ac Mon Sep 17 00:00:00 2001 From: Tvrtko Sternak Date: Tue, 21 Jan 2025 17:55:35 +0100 Subject: [PATCH] Do not censor Skip Exceptions --- test/conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index d33d8ca6b7..b737583ef5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -10,6 +10,7 @@ from typing import Any, Optional import pytest +from _pytest.outcomes import Skipped from pytest import CallInfo, Item import autogen @@ -135,7 +136,13 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[Any]) -> None: This is called after each test call. """ if call.excinfo is not None: # This means the test failed - original_message = "".join([repr(arg) for arg in call.excinfo.value.args]) + exception_value = call.excinfo.value + + original_message = "".join([repr(arg) for arg in exception_value.args]) + + # Check if this exception is a pytest skip exception + if isinstance(exception_value, Skipped): + return # Don't modify skip exceptions if Secrets.needs_sanitizing(original_message): censored_exception = CensoredError(call.excinfo.value)