#NEWLINE# def addfinalizer( self , teardown_func ) : #NEWLINE# #INDENT# if ( self . _stage in ( self . STAGE_SETUP , self . STAGE_TEST_METHOD , self . STAGE_TEARDOWN ) ) : #NEWLINE# #INDENT# self . __extra_test_teardowns . append ( teardown_func ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . _stage in ( self . STAGE_CLASS_SETUP , self . STAGE_CLASS_TEARDOWN ) ) : #NEWLINE# #INDENT# self . __extra_class_teardowns . append ( teardown_func ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'Tried to add a teardown while the test was not being executed.' )