#NEWLINE# def test_keyboard_interrupt_is_captured( self ) : #NEWLINE# #INDENT# iterable = ExitingIterable ( ( lambda : KeyboardInterrupt ( ) ) ) #NEWLINE# app = ExampleApp ( iterable ) #NEWLINE# middleware = Sentry ( app , client = response . client ) #NEWLINE# response = middleware ( self . request . environ , ( lambda * args : None ) ) #NEWLINE# with self . assertRaises ( KeyboardInterrupt ) : #NEWLINE# #INDENT# response = list ( response ) #NEWLINE# #UNINDENT# self . assertTrue ( iterable . closed , True ) #NEWLINE# self . assertEquals ( len ( self . client . events ) , 1 ) #NEWLINE# event = self . client . events . pop ( 0 ) #NEWLINE# assert ( 'exception' in event ) #NEWLINE# exc = event [ 'exception' ] [ 'values' ] [ 0 ] #NEWLINE# self . assertEquals ( exc [ 'type' ] , 'KeyboardInterrupt' ) #NEWLINE# self . assertEquals ( exc [ 'value' ] , '' ) #NEWLINE# self . assertEquals ( event [ 'level' ] , logging . ERROR )