#NEWLINE# def testAcquireLockWithError( self ) : #NEWLINE# #INDENT# 'Test Lock.Acquire failure in try/except that encounters an error.' #NEWLINE# error_was_raised = False #NEWLINE# lock = self . _RunAsync ( Lock . Acquire , self . _client , 'tst' , 'id0' , None ) #NEWLINE# try : #NEWLINE# #INDENT# raise Exception ( 'raise an error' ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . assertEqual ( e . message , 'raise an error' ) #NEWLINE# error_was_raised = True #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . _RunAsync ( lock . Release , self . _client ) #NEWLINE# #UNINDENT# self . assertTrue ( error_was_raised ) #NEWLINE# self . assertTrue ( lock . IsReleased ( ) ) #NEWLINE# self . assertTrue ( lock . AmOwner ( ) ) #NEWLINE# lock = self . _RunAsync ( Lock . Acquire , self . _client , 'tst' , 'id0' , None ) #NEWLINE# self . assertTrue ( lock . AmOwner ( ) ) #NEWLINE# self . assertTrue ( ( not lock . IsReleased ( ) ) ) #NEWLINE# self . _RunAsync ( lock . Release , self . _client )