#NEWLINE# def testCancelDispatch( self ) : #NEWLINE# #INDENT# def onlyRunOnce( dispatcher , nodes ) : #NEWLINE# #INDENT# if len ( s [ 'n1' ] . log ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# return False #NEWLINE# #UNINDENT# connection = GafferDispatch . Dispatcher . preDispatchSignal ( ) . connect ( onlyRunOnce ) #NEWLINE# dispatcher = GafferDispatch . Dispatcher . create ( 'testDispatcher' ) #NEWLINE# s = Gaffer . ScriptNode ( ) #NEWLINE# s [ 'n1' ] = GafferDispatchTest . LoggingExecutableNode ( ) #NEWLINE# self . assertEqual ( len ( self [ 'n1' ] . log ) , 0 ) #NEWLINE# dispatcher . dispatch ( [ s [ 'n1' ] ] ) #NEWLINE# self . assertEqual ( len ( s [ 'n1' ] . log ) , 1 ) #NEWLINE# dispatcher . dispatch ( [ s [ 'n1' ] ] ) #NEWLINE# self . assertEqual ( len ( s [ 'n1' ] . log ) , 1 )