#NEWLINE# def test_with_error( self ) : #NEWLINE# #INDENT# request = pretend . stub ( raven = pretend . stub ( captureException = pretend . call_recorder ( ( lambda : None ) ) ) ) #NEWLINE# class TestException ( Exception ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ pretend . call_recorder #NEWLINE# def handler( request ) : #NEWLINE# #INDENT# raise TestException #NEWLINE# #UNINDENT# tween = raven . raven_tween_factory ( handler , pretend . stub ( ) ) #NEWLINE# with pytest . raises ( TestException ) : #NEWLINE# #INDENT# tween ( request ) #NEWLINE# #UNINDENT# assert ( handler . calls == [ pretend . call ( request ) ] ) #NEWLINE# assert ( request . raven . captureException . calls == [ pretend . call ( ) ] )