##// END OF EJS Templates
Fix fallback prompt & improve info on test failure
Thomas Kluyver -
Show More
@@ -52,5 +52,9 b' class TestFileToRun(unittest.TestCase, tt.TempFileMixin):'
52 self.mktmp(src)
52 self.mktmp(src)
53
53
54 out, err = tt.ipexec(self.fname, options=['-i'],
54 out, err = tt.ipexec(self.fname, options=['-i'],
55 commands=['"__file__" in globals()', 'exit()'])
55 commands=['"__file__" in globals()', 'print(123)', 'exit()'])
56 self.assertIn("False", out)
56 if 'False' not in out:
57 print("Subprocess stderr:")
58 print(err)
59 print('-----')
60 raise AssertionError("'False' not found in %r" % out)
@@ -229,16 +229,15 b' class TerminalInteractiveShell(InteractiveShell):'
229 def init_prompt_toolkit_cli(self):
229 def init_prompt_toolkit_cli(self):
230 if self.simple_prompt:
230 if self.simple_prompt:
231 # Fall back to plain non-interactive output for tests.
231 # Fall back to plain non-interactive output for tests.
232 # This is very limited, and only accepts a single line.
232 # This is very limited.
233 def prompt():
233 def prompt():
234 isp = self.input_splitter
234 itm = self.input_transformer_manager
235 prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens())
235 prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens())
236 lines = [input(prompt_text)]
236 prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens())
237 prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens())
237 while isp.push_accepts_more():
238 while not itm.check_complete('\n'.join(lines)):
238 line = input(prompt_text)
239 lines.append( input(prompt_continuation) )
239 isp.push(line)
240 return '\n'.join(lines)
240 prompt_text = prompt_continuation
241 return isp.source_reset()
242 self.prompt_for_code = prompt
241 self.prompt_for_code = prompt
243 return
242 return
244
243
General Comments 0
You need to be logged in to leave comments. Login now