##// END OF EJS Templates
try to avoid using ptk in subprocess tests
Matthias Bussonnier -
Show More
@@ -20,6 +20,11 b' from prompt_toolkit import __version__ as ptk_version'
20 PTK3 = ptk_version.startswith('3.')
20 PTK3 = ptk_version.startswith('3.')
21
21
22
22
23 # we want to avoid ptk as much as possible when using subprocesses
24 # as it uses cursor positioning requests, deletes color ....
25 _use_simple_prompt = "IPY_TEST_SIMPLE_PROMPT" in os.environ
26
27
23 class TerminalPdb(Pdb):
28 class TerminalPdb(Pdb):
24 """Standalone IPython debugger."""
29 """Standalone IPython debugger."""
25
30
@@ -87,6 +92,7 b' class TerminalPdb(Pdb):'
87 if not PTK3:
92 if not PTK3:
88 options['inputhook'] = self.shell.inputhook
93 options['inputhook'] = self.shell.inputhook
89 options.update(pt_session_options)
94 options.update(pt_session_options)
95 if not _use_simple_prompt:
90 self.pt_loop = asyncio.new_event_loop()
96 self.pt_loop = asyncio.new_event_loop()
91 self.pt_app = PromptSession(**options)
97 self.pt_app = PromptSession(**options)
92
98
@@ -121,10 +127,15 b' class TerminalPdb(Pdb):'
121 self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals
127 self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals
122
128
123 # Run the prompt in a different thread.
129 # Run the prompt in a different thread.
130 if not _use_simple_prompt:
124 try:
131 try:
125 line = self.thread_executor.submit(self.pt_app.prompt).result()
132 line = self.thread_executor.submit(
133 self.pt_app.prompt
134 ).result()
126 except EOFError:
135 except EOFError:
127 line = "EOF"
136 line = "EOF"
137 else:
138 line = input("ipdb> ")
128
139
129 line = self.precmd(line)
140 line = self.precmd(line)
130 stop = self.onecmd(line)
141 stop = self.onecmd(line)
General Comments 0
You need to be logged in to leave comments. Login now