Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit dae4972b4d0d88f539532829cf143a98b20d0d45 1 parent d406a8d
@kmtracey kmtracey authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 django/test/simple.py
View
6 django/test/simple.py
@@ -27,8 +27,10 @@ def run(self, *args, **kwargs):
"""
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):
Please sign in to comment.
Something went wrong with that request. Please try again.