#NEWLINE# def testCallBeforeStartupUnexecuted( self ) : #NEWLINE# #INDENT# progname = self . mktemp ( ) #NEWLINE# progfile = open ( progname , 'w' ) #NEWLINE# progfile . write ( ( _callBeforeStartupProgram % { #NEWLINE# #INDENT# 'reactor' : reactor . __module__ , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# progfile . close ( ) #NEWLINE# def programFinished( result ) : #NEWLINE# #INDENT# ( out , err , reason ) = result #NEWLINE# if reason . check ( error . ProcessTerminated ) : #NEWLINE# #INDENT# self . fail ( ( 'Process did not exit cleanly (out: %s err: %s)' % ( out , err ) ) ) #NEWLINE# #UNINDENT# if err : #NEWLINE# #INDENT# log . msg ( ( 'Unexpected output on standard error: %s' % ( err , ) ) ) #NEWLINE# #UNINDENT# self . assertFalse ( out , ( 'Expected no output, instead received:\n%s' % ( out , ) ) ) #NEWLINE# #UNINDENT# def programTimeout( err ) : #NEWLINE# #INDENT# err . trap ( error . TimeoutError ) #NEWLINE# proto . signalProcess ( 'KILL' ) #NEWLINE# return err #NEWLINE# #UNINDENT# env = os . environ . copy ( ) #NEWLINE# env [ 'PYTHONPATH' ] = os . pathsep . join ( sys . path ) #NEWLINE# d = defer . Deferred ( ) . addCallbacks ( programFinished , programTimeout ) #NEWLINE# proto = ThreadStartupProcessProtocol ( d ) #NEWLINE# reactor . spawnProcess ( proto , sys . executable , ( 'python' , progname ) , env ) #NEWLINE# return d