#NEWLINE# def testCleanUpWithErrors( self ) : #NEWLINE# #INDENT# class TestableTest ( unittest . TestCase ) : #NEWLINE# #INDENT# def testNothing( self ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# class MockResult ( object ) : #NEWLINE# #INDENT# errors = [ ] #NEWLINE# def addError( self , test , exc_info ) : #NEWLINE# #INDENT# self . errors . append ( ( test , exc_info ) ) #NEWLINE# #UNINDENT# #UNINDENT# result = MockResult ( ) #NEWLINE# test = TestableTest ( 'testNothing' ) #NEWLINE# test . _resultForDoCleanups = result #NEWLINE# exc1 = Exception ( 'foo' ) #NEWLINE# exc2 = Exception ( 'bar' ) #NEWLINE# def cleanup1( ) : #NEWLINE# #INDENT# raise exc1 #NEWLINE# #UNINDENT# def cleanup2( ) : #NEWLINE# #INDENT# raise exc2 #NEWLINE# #UNINDENT# test . addCleanup ( cleanup1 ) #NEWLINE# test . addCleanup ( cleanup2 ) #NEWLINE# self . assertFalse ( test . doCleanups ( ) ) #NEWLINE# ( ( test1 , ( Type1 , instance1 , _ ) ) , ( test2 , ( Type2 , instance2 , _ ) ) ) = reversed ( MockResult . errors ) #NEWLINE# self . assertEqual ( ( test1 , Type1 , instance1 ) , ( test , Exception , exc1 ) ) #NEWLINE# self . assertEqual ( ( test2 , Type2 , instance2 ) , ( test , Exception , exc2 ) )