Don't break into `pdb` for `raise unittest.SkipTest()`
This commit is contained in:
parent
15ac0349b2
commit
6e7917c1a0
|
@ -3,6 +3,7 @@ import argparse
|
||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
|
import unittest
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
|
@ -293,7 +294,9 @@ class PdbInvoke:
|
||||||
sys.stdout.write(out)
|
sys.stdout.write(out)
|
||||||
sys.stdout.write(err)
|
sys.stdout.write(err)
|
||||||
assert call.excinfo is not None
|
assert call.excinfo is not None
|
||||||
_enter_pdb(node, call.excinfo, report)
|
|
||||||
|
if not isinstance(call.excinfo.value, unittest.SkipTest):
|
||||||
|
_enter_pdb(node, call.excinfo, report)
|
||||||
|
|
||||||
def pytest_internalerror(self, excinfo: ExceptionInfo[BaseException]) -> None:
|
def pytest_internalerror(self, excinfo: ExceptionInfo[BaseException]) -> None:
|
||||||
tb = _postmortem_traceback(excinfo)
|
tb = _postmortem_traceback(excinfo)
|
||||||
|
|
|
@ -124,6 +124,18 @@ class TestPDB:
|
||||||
assert rep.skipped
|
assert rep.skipped
|
||||||
assert len(pdblist) == 0
|
assert len(pdblist) == 0
|
||||||
|
|
||||||
|
def test_pdb_on_raise_skiptest(self, pytester, pdblist) -> None:
|
||||||
|
rep = runpdb_and_get_report(
|
||||||
|
pytester,
|
||||||
|
"""
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
raise unittest.SkipTest("This is a common way to skip an entire file.")
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
assert rep.skipped
|
||||||
|
assert len(pdblist) == 0
|
||||||
|
|
||||||
def test_pdb_on_BdbQuit(self, pytester, pdblist) -> None:
|
def test_pdb_on_BdbQuit(self, pytester, pdblist) -> None:
|
||||||
rep = runpdb_and_get_report(
|
rep = runpdb_and_get_report(
|
||||||
pytester,
|
pytester,
|
||||||
|
|
Loading…
Reference in New Issue