#NEWLINE# @ operation #NEWLINE# def fail( ctx , **kwargs ) : #NEWLINE# #INDENT# fail_count = get_prop ( 'fail_count' , ctx , kwargs , 1000000 ) #NEWLINE# with update_storage ( ctx ) as data : #NEWLINE# #INDENT# data [ 'failure_invocation' ] = data . get ( 'failure_invocation' , [ ] ) #NEWLINE# data [ 'failure_invocation' ] . append ( time . time ( ) ) #NEWLINE# #UNINDENT# if ( len ( data [ 'failure_invocation' ] ) > fail_count ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# message = 'TEST_EXPECTED_FAIL' #NEWLINE# non_recoverable = get_prop ( 'non_recoverable' , ctx , kwargs , False ) #NEWLINE# recoverable = get_prop ( 'recoverable' , ctx , kwargs , False ) #NEWLINE# retry_after = get_prop ( 'retry_after' , ctx , kwargs ) #NEWLINE# if data : #NEWLINE# #INDENT# exception = NonRecoverableError ( message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if recoverable : #NEWLINE# #INDENT# exception = RecoverableError ( message , retry_after = retry_after ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# exception = RuntimeError ( message ) #NEWLINE# #UNINDENT# #UNINDENT# raise exception