Ensure the default keyboard interrupt handler is restored
even if the test runner raises an exception. Thanks Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d406a8de8a
commit
dae4972b4d
|
@ -27,8 +27,10 @@ class DjangoTestRunner(unittest.TextTestRunner):
|
|||
"""
|
||||
self._default_keyboard_interrupt_handler = signal.signal(signal.SIGINT,
|
||||
self._keyboard_interrupt_handler)
|
||||
result = super(DjangoTestRunner, self).run(*args, **kwargs)
|
||||
signal.signal(signal.SIGINT, self._default_keyboard_interrupt_handler)
|
||||
try:
|
||||
result = super(DjangoTestRunner, self).run(*args, **kwargs)
|
||||
finally:
|
||||
signal.signal(signal.SIGINT, self._default_keyboard_interrupt_handler)
|
||||
return result
|
||||
|
||||
def _keyboard_interrupt_handler(self, signal_number, stack_frame):
|
||||
|
|
Loading…
Reference in New Issue