#NEWLINE# def test_cached_retry_failure( self ) : #NEWLINE# #INDENT# a_failure = failure . Failure . from_exception ( RuntimeError ( 'Woot!' ) ) #NEWLINE# s = self . _get_storage ( ) #NEWLINE# s . ensure_atom ( test_utils . NoopRetry ( 'my retry' , provides = [ 'x' ] ) ) #NEWLINE# s . save ( 'my retry' , 'a' ) #NEWLINE# s . save ( 'my retry' , a_failure , states . FAILURE ) #NEWLINE# history = s . get_retry_history ( 'my retry' ) #NEWLINE# self . assertEqual ( [ ( 'a' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ] , list ( history ) ) #NEWLINE# self . assertTrue ( history . caused_by ( RuntimeError , include_retry = True ) ) #NEWLINE# self . assertIsNotNone ( history . failure ) #NEWLINE# self . assertEqual ( 1 , len ( history ) ) #NEWLINE# self . assertTrue ( s . has_failures ( ) ) #NEWLINE# self . assertEqual ( { #NEWLINE# #INDENT# 'my retry' : a_failure , #NEWLINE# #UNINDENT# } , s . get_failures ( ) )