MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_edit

Method test_edit

tests/test_pydev_ipython_011.py:188–308  ·  view source on GitHub ↗

Make sure we can issue an edit command

(self)

Source from the content-addressed store, hash-verified

186 self.restore_stdout()
187
188 def test_edit(self):
189 """Make sure we can issue an edit command"""
190 if os.environ.get("TRAVIS") == "true":
191 # This test is too flaky on travis.
192 return
193
194 from _pydev_bundle.pydev_ipython_console_011 import get_pydev_frontend
195
196 called_RequestInput = [False]
197 called_IPythonEditor = [False]
198
199 def start_client_thread(client_port):
200 class ClientThread(threading.Thread):
201 def __init__(self, client_port):
202 threading.Thread.__init__(self)
203 self.client_port = client_port
204
205 def run(self):
206 class HandleRequestInput:
207 def RequestInput(self):
208 called_RequestInput[0] = True
209 return "\n"
210
211 def IPythonEditor(self, name, line):
212 called_IPythonEditor[0] = (name, line)
213 return True
214
215 handle_request_input = HandleRequestInput()
216
217 from _pydev_bundle import pydev_localhost
218
219 self.client_server = client_server = SimpleXMLRPCServer(
220 (pydev_localhost.get_localhost(), self.client_port), logRequests=False
221 )
222 client_server.register_function(handle_request_input.RequestInput)
223 client_server.register_function(handle_request_input.IPythonEditor)
224 client_server.serve_forever()
225
226 def shutdown(self):
227 return
228 self.client_server.shutdown()
229
230 client_thread = ClientThread(client_port)
231 client_thread.daemon = True
232 client_thread.start()
233 return client_thread
234
235 # PyDevFrontEnd depends on singleton in IPython, so you
236 # can't make multiple versions. So we reuse self.front_end for
237 # all the tests
238 s = socket.socket()
239 s.bind(("", 0))
240 self.client_port = client_port = s.getsockname()[1]
241 s.close()
242 self.front_end = get_pydev_frontend(get_localhost(), client_port)
243
244 client_thread = start_client_thread(self.client_port)
245 orig_stdin = sys.stdin

Callers

nothing calls this directly

Calls 9

shutdownMethod · 0.95
get_pydev_frontendFunction · 0.90
get_localhostFunction · 0.90
StdInClass · 0.90
eq_Function · 0.85
getMethod · 0.45
closeMethod · 0.45
add_execMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected