Skip to content

Commit 4526176

Browse files
committed
Test fix
1 parent 6e7917c commit 4526176

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

testing/test_debugging.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ def pdb_env(request):
2020
pytester._monkeypatch.setenv("PDBPP_HIJACK_PDB", "0")
2121

2222

23-
def runpdb_and_get_report(pytester: Pytester, source: str):
23+
def runpdb(pytester: Pytester, source: str):
2424
p = pytester.makepyfile(source)
25-
result = pytester.runpytest_inprocess("--pdb", p)
25+
return pytester.runpytest_inprocess("--pdb", p)
26+
27+
28+
def runpdb_and_get_stdout(pytester: Pytester, source: str):
29+
result = runpdb(pytester, source)
30+
return result.stdout.str()
31+
32+
33+
def runpdb_and_get_report(pytester: Pytester, source: str):
34+
result = runpdb(pytester, source)
2635
reports = result.reprec.getreports("pytest_runtest_logreport") # type: ignore[attr-defined]
2736
assert len(reports) == 3, reports # setup/call/teardown
2837
return reports[1]
@@ -123,18 +132,16 @@ def test_func():
123132
)
124133
assert rep.skipped
125134
assert len(pdblist) == 0
126-
127-
def test_pdb_on_raise_skiptest(self, pytester, pdblist) -> None:
128-
rep = runpdb_and_get_report(
135+
136+
def test_pdb_on_top_level_raise_skiptest(self, pytester, pdblist) -> None:
137+
stdout = runpdb_and_get_stdout(
129138
pytester,
130139
"""
131140
import unittest
132-
133141
raise unittest.SkipTest("This is a common way to skip an entire file.")
134142
""",
135143
)
136-
assert rep.skipped
137-
assert len(pdblist) == 0
144+
assert "entering PDB" not in stdout, stdout
138145

139146
def test_pdb_on_BdbQuit(self, pytester, pdblist) -> None:
140147
rep = runpdb_and_get_report(

0 commit comments

Comments
 (0)