Skip to content

Commit

Permalink
test that keyboardinterrupt exits the debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmaissy committed May 1, 2018
1 parent d3d8aaa commit d950dde
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions testing/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import platform
import os
import signal

import _pytest._code
from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN
Expand Down Expand Up @@ -122,6 +123,18 @@ def test_func():
assert rep.failed
assert len(pdblist) == 1

def test_KeyboardInterrupt_exits_pdb(self, testdir, pdblist):
p1 = testdir.makepyfile("""
def test_func():
raise KeyboardInterrupt
""")
child = testdir.spawn_pytest("--pdb %s" % p1)
child.expect("(Pdb)")
child.kill(signal.SIGINT)
child.expect("KeyboardInterrupt")
child.expect("====== 1 failed")
self.flush(child)

def test_pdb_interaction(self, testdir):
p1 = testdir.makepyfile("""
def test_1():
Expand Down

0 comments on commit d950dde

Please sign in to comment.