#NEWLINE# def test_states_retry_failure_parent_flow_fails( self ) : #NEWLINE# #INDENT# flow = lf . Flow ( 'flow-1' , retry . Times ( 3 , 'r1' , provides = 'x1' ) ) . add ( utils . TaskNoRequiresNoReturns ( 'task1' ) , lf . Flow ( 'flow-2' , retry . Times ( 3 , 'r2' , provides = 'x2' ) ) . add ( utils . TaskNoRequiresNoReturns ( 'task2' ) , utils . TaskNoRequiresNoReturns ( 'task3' ) ) , utils . ConditionalTask ( 'task4' , rebind = { #NEWLINE# #INDENT# 'x' : 'x1' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# engine = self . _make_engine ( flow ) #NEWLINE# engine . storage . inject ( { #NEWLINE# #INDENT# 'y' : 2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with utils . CaptureListener ( engine ) as capturer : #NEWLINE# #INDENT# engine . run ( ) #NEWLINE# #UNINDENT# self . assertEqual ( { #NEWLINE# #INDENT# 'y' : 2 , #NEWLINE# 'x1' : 2 , #NEWLINE# 'x2' : 1 , #NEWLINE# #UNINDENT# } , engine . storage . fetch_all ( ) ) #NEWLINE# expected = [ 'flow-1.f RUNNING' , 'r1.r RUNNING' , 'r1.r SUCCESS(1)' , 'task1.t RUNNING' , 'task1.t SUCCESS(None)' , 'r2.r RUNNING' , 'r2.r SUCCESS(1)' , 'task2.t RUNNING' , 'task2.t SUCCESS(None)' , 'task3.t RUNNING' , 'task3.t SUCCESS(None)' , 'task4.t RUNNING' , 'task4.t FAILURE(Failure: RuntimeError: Woot!)' , 'task4.t REVERTING' , 'task4.t REVERTED(None)' , 'task3.t REVERTING' , 'task3.t REVERTED(None)' , 'task2.t REVERTING' , 'task2.t REVERTED(None)' , 'r2.r REVERTING' , 'r2.r REVERTED(None)' , 'task1.t REVERTING' , 'task1.t REVERTED(None)' , 'r1.r RETRYING' , 'task1.t PENDING' , 'r2.r PENDING' , 'task2.t PENDING' , 'task3.t PENDING' , 'task4.t PENDING' , 'r1.r RUNNING' , 'r1.r SUCCESS(2)' , 'task1.t RUNNING' , 'task1.t SUCCESS(None)' , 'r2.r RUNNING' , 'r2.r SUCCESS(1)' , 'task2.t RUNNING' , 'task2.t SUCCESS(None)' , 'task3.t RUNNING' , 'task3.t SUCCESS(None)' , 'task4.t RUNNING' , 'task4.t SUCCESS(None)' , 'flow-1.f SUCCESS' ] #NEWLINE# self . assertEqual ( expected , capturer . values )