Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/13917.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:class:`unittest.SkipTest` is no longer considered an interactive exception, i.e. :hook:`pytest_exception_interact` is no longer called for it.
5 changes: 1 addition & 4 deletions src/_pytest/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import sys
import types
from typing import Any
import unittest

from _pytest import outcomes
from _pytest._code import ExceptionInfo
Expand Down Expand Up @@ -295,9 +294,7 @@ def pytest_exception_interact(
sys.stdout.write(out)
sys.stdout.write(err)
assert call.excinfo is not None

if not isinstance(call.excinfo.value, unittest.SkipTest):
_enter_pdb(node, call.excinfo, report)
_enter_pdb(node, call.excinfo, report)

def pytest_internalerror(self, excinfo: ExceptionInfo[BaseException]) -> None:
exc_or_tb = _postmortem_exc_or_tb(excinfo)
Expand Down
5 changes: 4 additions & 1 deletion src/_pytest/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,10 @@ def check_interactive_exception(call: CallInfo[object], report: BaseReport) -> b
if hasattr(report, "wasxfail"):
# Exception was expected.
return False
if isinstance(call.excinfo.value, Skipped | bdb.BdbQuit):
unittest = sys.modules.get("unittest")
if isinstance(call.excinfo.value, Skipped | bdb.BdbQuit) or (
unittest is not None and isinstance(call.excinfo.value, unittest.SkipTest)
):
# Special control flow exception.
return False
return True
Expand Down