summaryrefslogtreecommitdiff
path: root/src/_pytest
diff options
context:
space:
mode:
Diffstat (limited to 'src/_pytest')
-rw-r--r--src/_pytest/unittest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index cc616578b..6a90188ca 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -343,6 +343,10 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
except AttributeError:
pass
+ # Convert unittest.SkipTest to pytest.skip.
+ # This is actually only needed for nose, which reuses unittest.SkipTest for
+ # its own nose.SkipTest. For unittest TestCases, SkipTest is already
+ # handled internally, and doesn't reach here.
unittest = sys.modules.get("unittest")
if (
unittest
@@ -350,7 +354,6 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
and isinstance(call.excinfo.value, unittest.SkipTest) # type: ignore[attr-defined]
):
excinfo = call.excinfo
- # Let's substitute the excinfo with a pytest.skip one.
call2 = CallInfo[None].from_call(
lambda: pytest.skip(str(excinfo.value)), call.when
)