@@ -25,6 +25,8 @@ def custom_pdb_calls():
2525
2626 # install dummy debugger class and track which methods were called on it
2727 class _CustomPdb (object ):
28+ quitting = False
29+
2830 def __init__ (self , * args , ** kwargs ):
2931 called .append ("init" )
3032
@@ -142,6 +144,9 @@ def test_pdb_interaction(self, testdir):
142144 def test_1():
143145 i = 0
144146 assert i == 1
147+
148+ def test_not_called_due_to_quit():
149+ pass
145150 """
146151 )
147152 child = testdir .spawn_pytest ("--pdb %s" % p1 )
@@ -150,8 +155,9 @@ def test_1():
150155 child .expect ("Pdb" )
151156 child .sendeof ()
152157 rest = child .read ().decode ("utf8" )
153- assert "1 failed" in rest
158+ assert "= 1 failed in " in rest
154159 assert "def test_1" not in rest
160+ assert "Exit: Quitting debugger" in rest
155161 self .flush (child )
156162
157163 @staticmethod
@@ -321,7 +327,7 @@ def test_pdb_interaction_on_collection_issue181(self, testdir):
321327 child = testdir .spawn_pytest ("--pdb %s" % p1 )
322328 # child.expect(".*import pytest.*")
323329 child .expect ("Pdb" )
324- child .sendeof ( )
330+ child .sendline ( "c" )
325331 child .expect ("1 error" )
326332 self .flush (child )
327333
@@ -388,6 +394,7 @@ def test_1():
388394 rest = child .read ().decode ("utf8" )
389395 assert "1 failed" in rest
390396 assert "reading from stdin while output" not in rest
397+ assert "BdbQuit" in rest
391398 self .flush (child )
392399
393400 def test_pdb_and_capsys (self , testdir ):
@@ -530,7 +537,9 @@ def test_foo(a):
530537 def test_pdb_collection_failure_is_shown (self , testdir ):
531538 p1 = testdir .makepyfile ("xxx" )
532539 result = testdir .runpytest_subprocess ("--pdb" , p1 )
533- result .stdout .fnmatch_lines (["*NameError*xxx*" , "*1 error*" ])
540+ result .stdout .fnmatch_lines (
541+ ["E NameError: *xxx*" , "*! *Exit: Quitting debugger !*" ] # due to EOF
542+ )
534543
535544 def test_enter_pdb_hook_is_called (self , testdir ):
536545 testdir .makeconftest (
0 commit comments