#NEWLINE# def test_runWithInteractionRaiseOriginalError( self ) : #NEWLINE# #INDENT# '\n        If rollback fails, L{ConnectionPool.runInteraction} raises the\n        original exception and log the error of the rollback.\n        ' #NEWLINE# class ConnectionRollbackRaise ( object ) : #NEWLINE# #INDENT# def __init__( self , pool ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# def rollback( self ) : #NEWLINE# #INDENT# raise RuntimeError ( 'problem!' ) #NEWLINE# #UNINDENT# #UNINDENT# class DummyTransaction ( object ) : #NEWLINE# #INDENT# def __init__( self , pool , connection ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# def raisingFunction( transaction ) : #NEWLINE# #INDENT# raise ValueError ( 'foo' ) #NEWLINE# #UNINDENT# pool = DummyConnectionPool ( ) #NEWLINE# pool . connectionFactory = ConnectionRollbackRaise #NEWLINE# pool . transactionFactory = DummyTransaction #NEWLINE# d = pool . runInteraction ( pool ) #NEWLINE# d = self . assertFailure ( d , ValueError ) #NEWLINE# def cbFailed( ignored ) : #NEWLINE# #INDENT# errors = self . flushLoggedErrors ( RuntimeError ) #NEWLINE# self . assertEqual ( len ( errors ) , 1 ) #NEWLINE# self . assertEqual ( errors [ 0 ] . value . args [ 0 ] , 'problem!' ) #NEWLINE# #UNINDENT# d . addCallback ( cbFailed ) #NEWLINE# return d