Skip to content

Commit 3a2a5b0

Browse files
committed
tests: fix test_trace_after_runpytest
1 parent 49f5a28 commit 3a2a5b0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

testing/test_pdb.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,19 +1027,25 @@ def test_trace_after_runpytest(testdir):
10271027
from _pytest.debugging import pytestPDB
10281028
10291029
def test_outer(testdir):
1030-
from _pytest.debugging import pytestPDB
1031-
10321030
assert len(pytestPDB._saved) == 1
10331031
1034-
testdir.runpytest("-k test_inner")
1032+
testdir.makepyfile(
1033+
\"""
1034+
from _pytest.debugging import pytestPDB
10351035
1036-
__import__('pdb').set_trace()
1036+
def test_inner():
1037+
assert len(pytestPDB._saved) == 2
1038+
print("test_inner_" + "end")
1039+
\"""
1040+
)
10371041
1038-
def test_inner(testdir):
1039-
assert len(pytestPDB._saved) == 2
1042+
result = testdir.runpytest("-s", "-k", "test_inner")
1043+
assert result.ret == 0
1044+
__import__('pdb').set_trace()
10401045
"""
10411046
)
1042-
child = testdir.spawn_pytest("-p pytester %s -k test_outer" % p1)
1047+
child = testdir.spawn_pytest("-s -p pytester %s -k test_outer" % p1)
1048+
child.expect("test_inner_end")
10431049
child.expect(r"\(Pdb")
10441050
child.sendline("c")
10451051
rest = child.read().decode("utf8")

0 commit comments

Comments
 (0)