• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pydev_localhost.get_localhost函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pydev_localhost.get_localhost函数的典型用法代码示例。如果您正苦于以下问题:Python get_localhost函数的具体用法?Python get_localhost怎么用?Python get_localhost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_localhost函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: run

 def run(self):
     class HandleRequestInput:
         def RequestInput(self):
             return 'RequestInput: OK'
     
     handle_request_input = HandleRequestInput()
     
     import pydev_localhost
     print('Starting client with:', pydev_localhost.get_localhost(), self.client_port)
     client_server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), self.client_port), logRequests=False)
     client_server.register_function(handle_request_input.RequestInput)
     client_server.serve_forever()
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:12,代码来源:check_pydevconsole.py


示例2: __init__

    def __init__(self, notifications_queue, port, daemon=False):
        threading.Thread.__init__(self)
        self.setDaemon(daemon) # If False, wait for all the notifications to be passed before exiting!
        self.finished = False
        self.notifications_queue = notifications_queue

        import pydev_localhost

        # It is necessary to specify an encoding, that matches
        # the encoding of all bytes-strings passed into an
        # XMLRPC call: "All 8-bit strings in the data structure are assumed to use the
        # packet encoding.  Unicode strings are automatically converted,
        # where necessary."
        # Byte strings most likely come from file names.
        encoding = file_system_encoding
        if encoding == "mbcs":
            # Windos symbolic name for the system encoding CP_ACP.
            # We need to convert it into a encoding that is recognized by Java.
            # Unfortunately this is not always possible. You could use
            # GetCPInfoEx and get a name similar to "windows-1251". Then
            # you need a table to translate on a best effort basis. Much to complicated.
            # ISO-8859-1 is good enough.
            encoding = "ISO-8859-1"

        self.server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), port),
                                       encoding=encoding)
开发者ID:650elx,项目名称:middleware,代码行数:26,代码来源:pydev_runfiles_xml_rpc.py


示例3: testServer

    def testServer(self):
        client_port, server_port = self.getFreeAddresses()
        class ServerThread(threading.Thread):
            def __init__(self, client_port, server_port):
                threading.Thread.__init__(self)
                self.client_port = client_port
                self.server_port = server_port
                
            def run(self):
                import pydev_localhost
                pydevconsole.StartServer(pydev_localhost.get_localhost(), self.server_port, self.client_port)
        server_thread = ServerThread(client_port, server_port)
        server_thread.setDaemon(True)
        server_thread.start()

        client_thread = self.startClientThread(client_port) #@UnusedVariable
        
        import time
        time.sleep(.3) #let's give it some time to start the threads
        
        import pydev_localhost
        server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), server_port))
        server.addExec('class Foo:')
        server.addExec('    pass')
        server.addExec('')
        server.addExec('foo = Foo()')
        server.addExec('a = %s()' % (raw_input_name,))
        server.addExec('print (a)')
        self.assertEqual(['input_request'], sys.stdout.getvalue().split())
开发者ID:MrGreen123,项目名称:Pydev,代码行数:29,代码来源:test_pydevconsole.py


示例4: connectToDebugger

    def connectToDebugger(self, debuggerPort):
        """
        Used to show console with variables connection.
        Mainly, monkey-patches things in the debugger structure so that the debugger protocol works.
        """
        try:
            # Try to import the packages needed to attach the debugger
            import pydevd
            import pydevd_vars
            import threading
        except:
            # This happens on Jython embedded in host eclipse
            import traceback

            traceback.print_exc()
            return ("pydevd is not available, cannot connect",)

        import pydev_localhost

        threading.currentThread().__pydevd_id__ = "console_main"

        pydevd_vars.findFrame = self._findFrame

        self.debugger = pydevd.PyDB()
        try:
            self.debugger.connect(pydev_localhost.get_localhost(), debuggerPort)
        except:
            import traceback

            traceback.print_exc()
            return "Failed to connect to target debugger."
        return ("connect complete",)
开发者ID:MyDreamMyWay,项目名称:HBuilder-opensource,代码行数:32,代码来源:pydev_console_utils.py


示例5: __init__

    def __init__(self, tests_queue):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.queue = tests_queue
        self.finished = False
        from pydev_imports import SimpleXMLRPCServer
        
        
        # This is a hack to patch slow socket.getfqdn calls that
        # BaseHTTPServer (and its subclasses) make.
        # See: http://bugs.python.org/issue6085
        # See: http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/
        try:
            import BaseHTTPServer
            def _bare_address_string(self):
                host, port = self.client_address[:2]
                return '%s' % host
            BaseHTTPServer.BaseHTTPRequestHandler.address_string = _bare_address_string
            
        except:
            pass
        # End hack.


        # Create server
        
        import pydev_localhost
        server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), 0), logRequests=False)
        server.register_function(self.GetTestsToRun)
        server.register_function(self.notifyStartTest)
        server.register_function(self.notifyTest)
        server.register_function(self.notifyCommands)
        self.port = server.socket.getsockname()[1]
        self.server = server
开发者ID:Naviacom,项目名称:Configurations,代码行数:34,代码来源:pydev_runfiles_parallel.py


示例6: testServer

    def testServer(self):
        client_port, server_port = self.getFreeAddresses()

        class ServerThread(threading.Thread):
            def __init__(self, client_port, server_port):
                threading.Thread.__init__(self)
                self.client_port = client_port
                self.server_port = server_port

            def run(self):
                import pydev_localhost

                print('Starting server with:', pydev_localhost.get_localhost(), self.server_port, self.client_port)
                pydevconsole.StartServer(pydev_localhost.get_localhost(), self.server_port, self.client_port)

        server_thread = ServerThread(client_port, server_port)
        server_thread.setDaemon(True)
        server_thread.start()

        client_thread = self.startClientThread(client_port)  #@UnusedVariable

        import time

        time.sleep(.3)  #let's give it some time to start the threads

        import pydev_localhost

        server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), server_port))
        server.addExec("import sys; print('Running with: %s %s' % (sys.executable or sys.platform, sys.version))")
        server.addExec('class Foo:')
        server.addExec('    pass')
        server.addExec('')
        server.addExec('foo = Foo()')
        server.addExec('a = %s()' % raw_input_name)
        server.addExec('print (a)')
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:35,代码来源:check_pydevconsole.py


示例7: do_connect_to_debugger

        def do_connect_to_debugger():
            try:
                # Try to import the packages needed to attach the debugger
                import pydevd
                import _pydev_threading as threading

            except:
                # This happens on Jython embedded in host eclipse
                traceback.print_exc()
                sys.stderr.write('pydevd is not available, cannot connect\n',)

            import pydev_localhost
            threading.currentThread().__pydevd_id__ = "console_main"

            self.orig_findFrame = pydevd_vars.findFrame
            pydevd_vars.findFrame = self._findFrame

            self.debugger = pydevd.PyDB()
            try:
                self.debugger.connect(pydev_localhost.get_localhost(), debuggerPort)
                self.debugger.prepareToRun()
                import pydevd_tracing
                pydevd_tracing.SetTrace(None)
            except:
                traceback.print_exc()
                sys.stderr.write('Failed to connect to target debugger.\n')

            # Register to process commands when idle
            self.debugrunning = False
            try:
                import pydevconsole
                pydevconsole.set_debug_hook(self.debugger.processInternalCommands)
            except:
                traceback.print_exc()
                sys.stderr.write('Version of Python does not support debuggable Interactive Console.\n')
开发者ID:ArcherSys,项目名称:DevRake,代码行数:35,代码来源:pydev_console_utils.py


示例8: testServer

    def testServer(self):
        # Just making sure that the singleton is created in this thread.
        try:
            from pydev_ipython_console_011 import get_pydev_frontend
        except:
            sys.stderr.write('Skipped test because IPython could not be imported.')
            return
        get_pydev_frontend(get_localhost(), 0)

        client_port, server_port = self.getFreeAddresses()
        class ServerThread(threading.Thread):
            def __init__(self, client_port, server_port):
                threading.Thread.__init__(self)
                self.client_port = client_port
                self.server_port = server_port

            def run(self):
                import pydev_localhost
                print('Starting server with:', pydev_localhost.get_localhost(), self.server_port, self.client_port)
                pydevconsole.StartServer(pydev_localhost.get_localhost(), self.server_port, self.client_port)
        server_thread = ServerThread(client_port, server_port)
        server_thread.setDaemon(True)
        server_thread.start()

        client_thread = self.startClientThread(client_port) #@UnusedVariable

        try:
            import time
            time.sleep(.3) #let's give it some time to start the threads

            import pydev_localhost
            server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), server_port))
            server.execLine("import sys; print('Running with: %s %s' % (sys.executable or sys.platform, sys.version))")
            server.execLine('class Foo:')
            server.execLine('    pass')
            server.execLine('')
            server.execLine('foo = Foo()')
            server.execLine('a = %s()' % raw_input_name)
            initial = time.time()
            while not client_thread.requested_input:
                if time.time() - initial > 2:
                    raise AssertionError('Did not get the return asked before the timeout.')
                time.sleep(.1)
            frame_xml = server.getFrame()
            self.assert_('RequestInput' in frame_xml, 'Did not fid RequestInput in:\n%s' % (frame_xml,))
        finally:
            client_thread.shutdown()
开发者ID:650elx,项目名称:middleware,代码行数:47,代码来源:test_check_pydevconsole.py


示例9: __init__

 def __init__(self, notifications_queue, port):
     threading.Thread.__init__(self)
     self.setDaemon(False) #Wait for all the notifications to be passed before exiting!
     self.finished = False
     self.notifications_queue = notifications_queue
     
     import pydev_localhost
     self.server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), port))
开发者ID:iswar,项目名称:Pydev,代码行数:8,代码来源:pydev_runfiles_xml_rpc.py


示例10: setUp

 def setUp(self):
     # PyDevFrontEnd depends on singleton in IPython, so you
     # can't make multiple versions. So we reuse self.front_end for
     # all the tests
     self.front_end = get_pydev_frontend(get_localhost(), 0)
     
     from pydev_ipython.inputhook import set_return_control_callback
     set_return_control_callback(lambda:True)
     self.front_end.clearBuffer()
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:9,代码来源:test_pydev_ipython_011.py


示例11: run_client

def run_client(job_id, port, verbosity, coverage_output_file, coverage_include):
    job_id = int(job_id)
    
    import pydev_localhost
    server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), port))
    server.lock = threading.Lock()

    
    server_comm = ServerComm(job_id, server)
    server_comm.start()
    
    try:
        server_facade = ServerFacade(server_comm.notifications_queue)
        import pydev_runfiles
        import pydev_runfiles_xml_rpc
        pydev_runfiles_xml_rpc.SetServer(server_facade)
        
        tests_to_run = [1]
        while tests_to_run:
            #Investigate: is it dangerous to use the same xmlrpclib server from different threads?
            #It seems it should be, as it creates a new connection for each request...
            server.lock.acquire()
            try:
                tests_to_run = server.GetTestsToRun(job_id)
            finally:
                server.lock.release()
            
            if not tests_to_run:
                break
            
            files_to_tests = {}
            for test in tests_to_run:
                filename_and_test = test.split('|')
                if len(filename_and_test) == 2:
                    files_to_tests.setdefault(filename_and_test[0], []).append(filename_and_test[1])
    
            configuration = pydev_runfiles.Configuration(
                '', 
                verbosity, 
                None, 
                None, 
                None, 
                files_to_tests, 
                1, 
                None, 
                coverage_output_file=coverage_output_file, 
                coverage_include=coverage_include, 
            )
            test_runner = pydev_runfiles.PydevTestRunner(configuration)
            sys.stdout.flush()
            test_runner.run_tests()
        
    except:
        traceback.print_exc()
    server_comm.notifications_queue.put_nowait(KillServer())
开发者ID:iswar,项目名称:Pydev,代码行数:55,代码来源:pydev_runfiles_parallel_client.py


示例12: testConsoleHello

    def testConsoleHello(self):
        client_port, _server_port = self.getFreeAddresses()
        client_thread = self.startClientThread(client_port) #@UnusedVariable
        import time
        time.sleep(.3) #let's give it some time to start the threads
        
        import pydev_localhost
        interpreter = pydevconsole.InterpreterInterface(pydev_localhost.get_localhost(), client_port)

        (result,) = interpreter.hello("Hello pydevconsole")
        self.assertEqual(result, "Hello eclipse")      
开发者ID:Acidburn0zzz,项目名称:kali-2,代码行数:11,代码来源:test_pydevconsole.py


示例13: run

                def run(self):
                    class HandleRequestInput:
                        def RequestInput(self):
                            called_RequestInput[0] = True
                            return '\n'
                        def OpenEditor(self, name, line):
                            called_OpenEditor[0] = (name, line)
                            return True

                    handle_request_input = HandleRequestInput()

                    import pydev_localhost
                    client_server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), self.client_port), logRequests=False)
                    client_server.register_function(handle_request_input.RequestInput)
                    client_server.register_function(handle_request_input.OpenEditor)
                    client_server.serve_forever()
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:16,代码来源:test_pydev_ipython_011.py


示例14: run

 def run(self):
     class HandleRequestInput:
         def RequestInput(self):
             client_thread.requested_input = True
             return 'RequestInput: OK'
         
         def NotifyFinished(self, *args, **kwargs):
             client_thread.notified_finished += 1
             return 1
     
     handle_request_input = HandleRequestInput()
     
     import pydev_localhost
     self.client_server = client_server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), self.client_port), logRequests=False)
     client_server.register_function(handle_request_input.RequestInput)
     client_server.register_function(handle_request_input.NotifyFinished)
     client_server.serve_forever()
开发者ID:Naviacom,项目名称:Configurations,代码行数:17,代码来源:test_check_pydevconsole.py


示例15: testConsoleHello

 def testConsoleHello(self):
     self.original_stdout = sys.stdout
     sys.stdout = StringIO()
     
     try:
         client_port, _server_port = self.getFreeAddresses()
         client_thread = self.startClientThread(client_port)  #@UnusedVariable
         import time
         time.sleep(.3)  #let's give it some time to start the threads
 
         import pydev_localhost
         interpreter = pydevconsole.InterpreterInterface(pydev_localhost.get_localhost(), client_port, threading.currentThread())
 
         (result,) = interpreter.hello("Hello pydevconsole")
         self.assertEqual(result, "Hello eclipse")
     finally:
         sys.stdout = self.original_stdout
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:17,代码来源:test_pydevconsole.py


示例16: testServer

 def testServer(self):
     self.original_stdout = sys.stdout
     sys.stdout = StringIO()
     try:
         client_port, server_port = self.getFreeAddresses()
         class ServerThread(threading.Thread):
             def __init__(self, client_port, server_port):
                 threading.Thread.__init__(self)
                 self.client_port = client_port
                 self.server_port = server_port
 
             def run(self):
                 import pydev_localhost
                 pydevconsole.StartServer(pydev_localhost.get_localhost(), self.server_port, self.client_port)
         server_thread = ServerThread(client_port, server_port)
         server_thread.setDaemon(True)
         server_thread.start()
 
         client_thread = self.startClientThread(client_port)  #@UnusedVariable
 
         import time
         time.sleep(.3)  #let's give it some time to start the threads
         sys.stdout = StringIO()
 
         import pydev_localhost
         server = xmlrpclib.Server('http://%s:%s' % (pydev_localhost.get_localhost(), server_port))
         server.execLine('class Foo:')
         server.execLine('    pass')
         server.execLine('')
         server.execLine('foo = Foo()')
         server.execLine('a = %s()' % (raw_input_name,))
         server.execLine('print (a)')
         initial = time.time()
         while not client_thread.requested_input:
             if time.time() - initial > 2:
                 raise AssertionError('Did not get the return asked before the timeout.')
             time.sleep(.1)
             
         while ['input_request'] != sys.stdout.getvalue().split():
             if time.time() - initial > 2:
                 break
             time.sleep(.1)
         self.assertEqual(['input_request'], sys.stdout.getvalue().split())
     finally:
         sys.stdout = self.original_stdout
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:45,代码来源:test_pydevconsole.py


示例17: testEdit

    def testEdit(self):
        ''' Make sure we can issue an edit command '''
        called_RequestInput = [False]
        called_OpenEditor = [False]
        def startClientThread(client_port):
            class ClientThread(threading.Thread):
                def __init__(self, client_port):
                    threading.Thread.__init__(self)
                    self.client_port = client_port
                def run(self):
                    class HandleRequestInput:
                        def RequestInput(self):
                            called_RequestInput[0] = True
                            return '\n'
                        def OpenEditor(self, name, line):
                            called_OpenEditor[0] = (name, line)
                            return True

                    handle_request_input = HandleRequestInput()

                    import pydev_localhost
                    client_server = SimpleXMLRPCServer((pydev_localhost.get_localhost(), self.client_port), logRequests=False)
                    client_server.register_function(handle_request_input.RequestInput)
                    client_server.register_function(handle_request_input.OpenEditor)
                    client_server.serve_forever()

            client_thread = ClientThread(client_port)
            client_thread.setDaemon(True)
            client_thread.start()
            return client_thread

        startClientThread(client_port)
        orig_stdin = sys.stdin
        sys.stdin = StdIn(self, get_localhost(), client_port)
        try:
            filename = 'made_up_file.py'
            addExec('%edit ' + filename)
            eq_(called_OpenEditor[0], (os.path.abspath(filename), 0))
            assert called_RequestInput[0], "Make sure the 'wait' parameter has been respected"
        finally:
            sys.stdin = orig_stdin
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:41,代码来源:test_pydev_ipython_011.py


示例18: connectToDebugger

    def connectToDebugger(self, debuggerPort):
        '''
        Used to show console with variables connection.
        Mainly, monkey-patches things in the debugger structure so that the debugger protocol works.
        '''
        try:
            # Try to import the packages needed to attach the debugger
            import pydevd
            import pydevd_vars
            import threading
        except:
            # This happens on Jython embedded in host eclipse
            import traceback;traceback.print_exc()
            return ('pydevd is not available, cannot connect',)

        import pydev_localhost
        threading.currentThread().__pydevd_id__ = "console_main"

        self.orig_findFrame = pydevd_vars.findFrame
        pydevd_vars.findFrame = self._findFrame

        self.debugger = pydevd.PyDB()
        try:
            self.debugger.connect(pydev_localhost.get_localhost(), debuggerPort)
            self.debugger.prepareToRun()
            import pydevd_tracing
            pydevd_tracing.SetTrace(None)
        except:
            import traceback;traceback.print_exc()
            return ('Failed to connect to target debugger.')

        # Register to process commands when idle
        self.debugrunning = False
        try:
            self.server.setDebugHook(self.debugger.processInternalCommands)
        except:
            import traceback;traceback.print_exc()
            return ('Version of Python does not support debuggable Interactive Console.')

        return ('connect complete',)
开发者ID:WamBamBoozle,项目名称:intellij-community,代码行数:40,代码来源:pydev_console_utils.py


示例19: testConsoleRequests

 def testConsoleRequests(self):
     client_port, _server_port = self.getFreeAddresses()
     client_thread = self.startClientThread(client_port) #@UnusedVariable
     import time
     time.sleep(.3) #let's give it some time to start the threads
     
     import pydev_localhost
     interpreter = pydevconsole.InterpreterInterface(pydev_localhost.get_localhost(), client_port)
     interpreter.addExec('class Foo:')
     interpreter.addExec('   CONSTANT=1')
     interpreter.addExec('')
     interpreter.addExec('foo=Foo()')
     interpreter.addExec('foo.__doc__=None')
     interpreter.addExec('val = %s()' % (raw_input_name,))
     interpreter.addExec('50')
     interpreter.addExec('print (val)')
     found = sys.stdout.getvalue().split()
     try:
         self.assertEqual(['50', 'input_request'], found)
     except:
         self.assertEqual(['input_request'], found) #IPython
     
     comps = interpreter.getCompletions('foo.', 'foo.')
     self.assert_(
         ('CONSTANT', '', '', '3') in comps or ('CONSTANT', '', '', '4') in comps,\
         'Found: %s' % comps
     )
     
     comps = interpreter.getCompletions('"".', '"".')
     self.assert_(
         ('__add__', 'x.__add__(y) <==> x+y', '', '3') in comps or 
         ('__add__', '', '', '4') in comps or 
         ('__add__', 'x.__add__(y) <==> x+y\r\nx.__add__(y) <==> x+y', '()', '2') in comps or
         ('__add__', 'x.\n__add__(y) <==> x+yx.\n__add__(y) <==> x+y', '()', '2'),
         'Did not find __add__ in : %s' % (comps,)
     )
     
     
     completions = interpreter.getCompletions('', '')
     for c in completions:
         if c[0] == 'AssertionError':
             break
     else:
         self.fail('Could not find AssertionError')
         
     completions = interpreter.getCompletions('Assert', 'Assert')
     for c in completions:
         if c[0] == 'RuntimeError':
             self.fail('Did not expect to find RuntimeError there')
     
     self.assert_(('__doc__', None, '', '3') not in interpreter.getCompletions('foo.CO', 'foo.'))
     
     comps = interpreter.getCompletions('va', 'va')
     self.assert_(('val', '', '', '3') in comps or ('val', '', '', '4') in comps)
     
     interpreter.addExec('s = "mystring"')
     
     desc = interpreter.getDescription('val')
     self.assert_(desc.find('str(object) -> string') >= 0 or 
                  desc == "'input_request'" or 
                  desc.find('str(string[, encoding[, errors]]) -> str') >= 0 or
                  desc.find('str(Char* value)') >= 0 or 
                  desc.find('str(value: Char*)') >= 0, 
                  'Could not find what was needed in %s' % desc)
     
     desc = interpreter.getDescription('val.join')
     self.assert_(desc.find('S.join(sequence) -> string') >= 0 or 
                  desc.find('S.join(sequence) -> str') >= 0 or 
                  desc.find('S.join(iterable) -> string') >= 0 or 
                  desc == "<builtin method 'join'>"  or 
                  desc == "<built-in method join of str object>" or
                  desc.find('str join(str self, list sequence)') >= 0 or
                  desc.find('S.join(iterable) -> str') >= 0 or
                  desc.find('join(self: str, sequence: list) -> str') >= 0,
                  "Could not recognize: %s" % (desc,))
开发者ID:MrGreen123,项目名称:Pydev,代码行数:75,代码来源:test_pydevconsole.py


示例20: testEdit

    def testEdit(self):
        ''' Make sure we can issue an edit command'''
        called_RequestInput = [False]
        called_IPythonEditor = [False]
        def startClientThread(client_port):
            class ClientThread(threading.Thread):
                def __init__(self, client_port):
                    threading.Thread.__init__(self)
                    self.client_port = client_port
                def run(self):
                    class HandleRequestInput:
                        def RequestInput(self):
                            called_RequestInput[0] = True
                            return '\n'
                        def IPythonEditor(self, name, line):
                            called_IPythonEditor[0] = (name, line)
                            return True

                    handle_request_input = HandleRequestInput()

                    import pydev_localhost
                    self.client_server = client_server = SimpleXMLRPCServer(
                        (pydev_localhost.get_localhost(), self.client_port), logRequests=False)
                    client_server.register_function(handle_request_input.RequestInput)
                    client_server.register_function(handle_request_input.IPythonEditor)
                    client_server.serve_forever()
                    
                def shutdown(self):
                    return
                    self.client_server.shutdown()

            client_thread = ClientThread(client_port)
            client_thread.setDaemon(True)
            client_thread.start()
            return client_thread

        # PyDevFrontEnd depends on singleton in IPython, so you
        # can't make multiple versions. So we reuse self.front_end for
        # all the tests
        s = socket.socket()
        s.bind(('', 0))
        self.client_port = client_port = s.getsockname()[1]
        s.close()
        self.front_end = get_pydev_frontend(get_localhost(), client_port)

        client_thread = startClientThread(self.client_port)
        orig_stdin = sys.stdin
        sys.stdin = StdIn(self, get_localhost(), self.client_port)
        try:
            filename = 'made_up_file.py'
            self.addExec('%edit ' + filename)
            
            for i in xrange(10):
                if called_IPythonEditor[0] == (os.path.abspath(filename), '0'):
                    break
                time.sleep(.1)
                
            eq_(called_IPythonEditor[0], (os.path.abspath(filename), '0'))
            assert called_RequestInput[0], "Make sure the 'wait' parameter has been respected"
        finally:
            sys.stdin = orig_stdin
            client_thread.shutdown()
开发者ID:32bitfloat,项目名称:intellij-community,代码行数:62,代码来源:test_pydev_ipython_011.py



注:本文中的pydev_localhost.get_localhost函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pydev_log.debug函数代码示例发布时间:2022-05-25
下一篇:
Python pydevd.settrace函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap