#NEWLINE# def testInterruptCaught( self ) : #NEWLINE# #INDENT# default_handler = signal . getsignal ( signal . SIGINT ) #NEWLINE# result = unittest . TestResult ( ) #NEWLINE# unittest . installHandler ( ) #NEWLINE# unittest . registerResult ( result ) #NEWLINE# self . assertNotEqual ( signal . getsignal ( signal . SIGINT ) , self ) #NEWLINE# def test( result ) : #NEWLINE# #INDENT# pid = os . getpid ( ) #NEWLINE# os . kill ( pid , signal . SIGINT ) #NEWLINE# result . breakCaught = True #NEWLINE# self . assertTrue ( result . shouldStop ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# test ( result ) #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# self . fail ( 'KeyboardInterrupt not handled' ) #NEWLINE# #UNINDENT# self . assertTrue ( result . breakCaught )