#NEWLINE# def __enter__( self ) : #NEWLINE# #INDENT# args = [ sys . executable , '-u' , '-m' , 'splash.server' ] #NEWLINE# args += [ '--port' , str ( self . portnum ) ] #NEWLINE# args += [ '--verbosity' , str ( self . verbosity ) ] #NEWLINE# if self . logfile : #NEWLINE# #INDENT# args += [ '-f' , args . logfile ] #NEWLINE# #UNINDENT# if self . proxy_profiles_path : #NEWLINE# #INDENT# args += [ '--proxy-profiles-path' , self . proxy_profiles_path ] #NEWLINE# #UNINDENT# if self . js_profiles_path : #NEWLINE# #INDENT# args += [ '--js-profiles-path' , self . js_profiles_path ] #NEWLINE# #UNINDENT# if self . filters_path : #NEWLINE# #INDENT# args += [ '--filters-path' , self . filters_path ] #NEWLINE# #UNINDENT# args . extend ( self . extra_args ) #NEWLINE# self . proc = Popen ( args , env = get_testenv ( ) ) #NEWLINE# self . proc . poll ( ) #NEWLINE# if ( self . proc . returncode is not None ) : #NEWLINE# #INDENT# msg = ( 'unable to start splash server. return code: %d' % self . proc . returncode ) #NEWLINE# raise RuntimeError ( msg ) #NEWLINE# #UNINDENT# _wait_for_port ( self . portnum ) #NEWLINE# return self