#NEWLINE# def test_when_subflow_fails_revert_success_tasks( self ) : #NEWLINE# #INDENT# waiting_task = utils . WaitForOneFromTask ( 'task2' , 'task1' , [ st . SUCCESS , st . FAILURE ] ) #NEWLINE# flow = uf . Flow ( 'flow-1' , retry . Times ( 3 , 'r' , provides = 'x' ) ) . add ( utils . ProgressingTask ( 'task1' ) , lf . Flow ( 'flow-2' ) . add ( waiting_task , utils . ConditionalTask ( 'task3' ) ) ) #NEWLINE# engine = self . _make_engine ( flow ) #NEWLINE# engine . task_notifier . register ( '*' , waiting_task . callback ) #NEWLINE# engine . storage . inject ( { #NEWLINE# #INDENT# 'y' : 2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with utils . CaptureListener ( engine , capture_flow = False ) as capturer : #NEWLINE# #INDENT# engine . run ( ) #NEWLINE# #UNINDENT# self . assertEqual ( { #NEWLINE# #INDENT# 'y' : 2 , #NEWLINE# 'x' : 2 , #NEWLINE# #UNINDENT# } , engine . storage . fetch_all ( ) ) #NEWLINE# expected = [ 'r.r RUNNING' , 'r.r SUCCESS(1)' , 'task1.t RUNNING' , 'task2.t RUNNING' , 'task1.t SUCCESS(5)' , 'task2.t SUCCESS(5)' , 'task3.t RUNNING' , 'task3.t FAILURE(Failure: RuntimeError: Woot!)' , 'task3.t REVERTING' , 'task1.t REVERTING' , 'task3.t REVERTED(None)' , 'task1.t REVERTED(None)' , 'task2.t REVERTING' , 'task2.t REVERTED(None)' , 'r.r RETRYING' , 'task1.t PENDING' , 'task2.t PENDING' , 'task3.t PENDING' , 'r.r RUNNING' , 'r.r SUCCESS(2)' , 'task1.t RUNNING' , 'task2.t RUNNING' , 'task1.t SUCCESS(5)' , 'task2.t SUCCESS(5)' , 'task3.t RUNNING' , 'task3.t SUCCESS(None)' ] #NEWLINE# self . assertItemsEqual ( capturer . values , expected )