Show More
@@ -101,9 +101,9 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
101 | 101 | ] |
|
102 | 102 | |
|
103 | 103 | def init_prompt_toolkit_cli(self): |
|
104 | if not sys.stdin.isatty(): | |
|
105 |
# |
|
|
106 |
# |
|
|
104 | if ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or not sys.stdin.isatty(): | |
|
105 | # Fall back to plain non-interactive output for tests. | |
|
106 | # This is very limited, and only accepts a single line. | |
|
107 | 107 | def prompt(): |
|
108 | 108 | return cast_unicode_py2(input('In [%d]: ' % self.execution_count)) |
|
109 | 109 | self.prompt_for_code = prompt |
@@ -12,9 +12,9 b'' | |||
|
12 | 12 | #----------------------------------------------------------------------------- |
|
13 | 13 | |
|
14 | 14 | import os |
|
15 | import subprocess | |
|
15 | 16 | import sys |
|
16 | 17 | import nose.tools as nt |
|
17 | from IPython.utils.process import process_handler | |
|
18 | 18 | from IPython.utils.tempdir import NamedFileInTemporaryDirectory |
|
19 | 19 | from IPython.testing.decorators import skip_win32 |
|
20 | 20 | |
@@ -47,9 +47,14 b' def test_ipython_embed():' | |||
|
47 | 47 | |
|
48 | 48 | # run `python file_with_embed.py` |
|
49 | 49 | cmd = [sys.executable, f.name] |
|
50 | env = os.environ.copy() | |
|
51 | env['IPY_TEST_SIMPLE_PROMPT'] = '1' | |
|
52 | ||
|
53 | p = subprocess.Popen(cmd, env=env, stdin=subprocess.PIPE, | |
|
54 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
|
55 | out, err = p.communicate(_exit) | |
|
56 | std = out.decode('UTF-8') | |
|
50 | 57 | |
|
51 | out, p = process_handler(cmd, lambda p: (p.communicate(_exit), p)) | |
|
52 | std = out[0].decode('UTF-8') | |
|
53 | 58 | nt.assert_equal(p.returncode, 0) |
|
54 | 59 | nt.assert_in('3 . 14', std) |
|
55 | 60 | if os.name != 'nt': |
@@ -62,9 +67,12 b' def test_nest_embed():' | |||
|
62 | 67 | """test that `IPython.embed()` is nestable""" |
|
63 | 68 | import pexpect |
|
64 | 69 | ipy_prompt = r']:' #ansi color codes give problems matching beyond this |
|
70 | env = os.environ.copy() | |
|
71 | env['IPY_TEST_SIMPLE_PROMPT'] = '1' | |
|
65 | 72 | |
|
66 | 73 | |
|
67 |
child = pexpect.spawn( |
|
|
74 | child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor'], | |
|
75 | env=env) | |
|
68 | 76 | child.expect(ipy_prompt) |
|
69 | 77 | child.sendline("from __future__ import print_function") |
|
70 | 78 | child.expect(ipy_prompt) |
General Comments 0
You need to be logged in to leave comments.
Login now