Skip to content

Commit 3dc7d38

Browse files
committed
debugging: import unittest lazily
Fix #13917
1 parent 3fe80c7 commit 3dc7d38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_pytest/debugging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import sys
1212
import types
1313
from typing import Any
14-
import unittest
1514

1615
from _pytest import outcomes
1716
from _pytest._code import ExceptionInfo
@@ -296,7 +295,8 @@ def pytest_exception_interact(
296295
sys.stdout.write(err)
297296
assert call.excinfo is not None
298297

299-
if not isinstance(call.excinfo.value, unittest.SkipTest):
298+
unittest = sys.modules.get("unittest")
299+
if unittest is None or not isinstance(call.excinfo.value, unittest.SkipTest):
300300
_enter_pdb(node, call.excinfo, report)
301301

302302
def pytest_internalerror(self, excinfo: ExceptionInfo[BaseException]) -> None:

0 commit comments

Comments
 (0)