##// END OF EJS Templates
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook....
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook. Here's a brief overview of the changes: - Display of messages from other clients can be toggled on and off from within a notebook, either using the ``<M-m>e`` keyboard shortcut in the web UI, or through the option in the "Kernel" menu. - notebook.js controls whether messages are displayed through a callback that is invoked from kernel.js when no callbacks are available for a message. - The UI displays ``execute_input`` messages originating from an other clients in new cells at the end of the notebook. Output messages (``execute_result`` et al.) will only be displayed if a cell exists with a matching message ID. Pending design questions: - Should each ``execute_input`` message cause a new cell to be created? - Should new cells be placed at the end of the notebook, or elsewhere? If the latter, what criteria should be followed?

File last commit:

r18037:ac835403
r19164:17ac8ca3
Show More
test_console.py
78 lines | 2.2 KiB | text/x-python | PythonLexer
MinRK
add single two-process terminal test
r5630 """Tests for two-process terminal frontend
MinRK
use `python -m IPython` in test_console as well
r11357 Currently only has the most simple test possible, starting a console and running
MinRK
add single two-process terminal test
r5630 a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
MinRK
use `python -m IPython` in test_console as well
r11357 import sys
MinRK
add single two-process terminal test
r5630
from nose import SkipTest
MinRK
test that `-h` and `--help-all` work for various IPython entry points...
r12354 import IPython.testing.tools as tt
MinRK
add single two-process terminal test
r5630 from IPython.testing import decorators as dec
#-----------------------------------------------------------------------------
MinRK
test that `-h` and `--help-all` work for various IPython entry points...
r12354 # Tests
MinRK
add single two-process terminal test
r5630 #-----------------------------------------------------------------------------
@dec.skip_win32
def test_console_starts():
"""test that `ipython console` starts a terminal"""
Paul Ivanov
refactor starting and stopping pexpect
r13819 p, pexpect, t = start_console()
MinRK
add single two-process terminal test
r5630 p.sendline('5')
MinRK
single timeout value for pexepect in test_console
r11796 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=t)
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
Paul Ivanov
refactor starting and stopping pexpect
r13819 stop_console(p, pexpect, t)
MinRK
test that `-h` and `--help-all` work for various IPython entry points...
r12354
def test_help_output():
"""ipython console --help-all works"""
tt.help_all_output_test('console')
Paul Ivanov
test for text/plain display handling in console
r13818
def test_display_text():
"Ensure display protocol plain/text key is supported"
# equivalent of:
#
# x = %lsmagic
# from IPython.display import display; display(x);
Paul Ivanov
refactor starting and stopping pexpect
r13819 p, pexpect, t = start_console()
p.sendline('x = %lsmagic')
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
p.sendline('from IPython.display import display; display(x);')
p.expect([r'Available line magics:', pexpect.EOF], timeout=t)
stop_console(p, pexpect, t)
def stop_console(p, pexpect, t):
"Stop a running `ipython console` running via pexpect"
# send ctrl-D;ctrl-D to exit
p.sendeof()
p.sendeof()
p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=t)
if p.isalive():
p.terminate()
Paul Ivanov
test for text/plain display handling in console
r13818
Paul Ivanov
refactor starting and stopping pexpect
r13819 def start_console():
"Start `ipython console` using pexpect"
Paul Ivanov
test for text/plain display handling in console
r13818 from IPython.external import pexpect
Matthias Bussonnier
drop some 2.6 hacks
r18037 args = ['-m', 'IPython', 'console', '--colors=NoColor']
cmd = sys.executable
Paul Ivanov
test for text/plain display handling in console
r13818
try:
p = pexpect.spawn(cmd, args=args)
except IOError:
raise SkipTest("Couldn't find command %s" % cmd)
# timeout after one minute
t = 60
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
Paul Ivanov
refactor starting and stopping pexpect
r13819 return p, pexpect, t