#NEWLINE# def test_sequential_flow_iter_suspend_resume( self ) : #NEWLINE# #INDENT# flow = lf . Flow ( 'flow-2' ) . add ( utils . ProgressingTask ( name = 'task1' ) , utils . ProgressingTask ( name = 'task2' ) ) #NEWLINE# ( lb , fd ) = p_utils . temporary_flow_detail ( self . backend ) #NEWLINE# engine = self . _make_engine ( flow , flow_detail = fd ) #NEWLINE# with utils . CaptureListener ( engine , capture_flow = False ) as capturer : #NEWLINE# #INDENT# it = engine . run_iter ( ) #NEWLINE# gathered_states = [ ] #NEWLINE# suspend_it = None #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# s = it . send ( suspend_it ) #NEWLINE# gathered_states . append ( gathered_states ) #NEWLINE# if ( s == states . WAITING ) : #NEWLINE# #INDENT# suspend_it = True #NEWLINE# #UNINDENT# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . assertTrue ( ( len ( gathered_states ) > 0 ) ) #NEWLINE# expected = [ 'task1.t RUNNING' , 'task1.t SUCCESS(5)' ] #NEWLINE# self . assertEqual ( expected , capturer . values ) #NEWLINE# self . assertEqual ( states . SUSPENDED , engine . storage . get_flow_state ( ) ) #NEWLINE# with utils . CaptureListener ( engine , capture_flow = False ) as capturer : #NEWLINE# #INDENT# gathered_states = list ( engine . run_iter ( ) ) #NEWLINE# #UNINDENT# self . assertTrue ( ( len ( gathered_states ) > 0 ) ) #NEWLINE# expected = [ 'task2.t RUNNING' , 'task2.t SUCCESS(5)' ] #NEWLINE# self . assertEqual ( expected , capturer . values ) #NEWLINE# self . assertEqual ( states . SUCCESS , engine . storage . get_flow_state ( ) )