diff --git a/IPython/core/tests/test_shellapp.py b/IPython/core/tests/test_shellapp.py index 8134269..dd18086 100644 --- a/IPython/core/tests/test_shellapp.py +++ b/IPython/core/tests/test_shellapp.py @@ -52,5 +52,9 @@ class TestFileToRun(unittest.TestCase, tt.TempFileMixin): self.mktmp(src) out, err = tt.ipexec(self.fname, options=['-i'], - commands=['"__file__" in globals()', 'exit()']) - self.assertIn("False", out) + commands=['"__file__" in globals()', 'print(123)', 'exit()']) + if 'False' not in out: + print("Subprocess stderr:") + print(err) + print('-----') + raise AssertionError("'False' not found in %r" % out) diff --git a/IPython/terminal/interactiveshell.py b/IPython/terminal/interactiveshell.py index fcad8ed..9578859 100644 --- a/IPython/terminal/interactiveshell.py +++ b/IPython/terminal/interactiveshell.py @@ -229,16 +229,15 @@ class TerminalInteractiveShell(InteractiveShell): def init_prompt_toolkit_cli(self): if self.simple_prompt: # Fall back to plain non-interactive output for tests. - # This is very limited, and only accepts a single line. + # This is very limited. def prompt(): - isp = self.input_splitter + itm = self.input_transformer_manager prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens()) + lines = [input(prompt_text)] prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens()) - while isp.push_accepts_more(): - line = input(prompt_text) - isp.push(line) - prompt_text = prompt_continuation - return isp.source_reset() + while not itm.check_complete('\n'.join(lines)): + lines.append( input(prompt_continuation) ) + return '\n'.join(lines) self.prompt_for_code = prompt return