##// END OF EJS Templates
Merge pull request #3756 from minrk/wiredoc...
Merge pull request #3756 from minrk/wiredoc document the wire protocol in the messaging doc also update the digest scheme to use sha256 and make this configurable, since md5 is the previous default and has been shown to be bad. More messaging docs to update here: - [x] remove get/setattr on kernel - [x] remove crash messages - [x] completion requests do not behave as documented - [x] object_info is misdocumented (`name` is actually `oname` in object_info_request)

File last commit:

r11358:653c12fb
r11721:42034aaf merge
Show More
test_console.py
58 lines | 1.7 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 import time
import nose.tools as nt
from nose import SkipTest
from IPython.testing import decorators as dec
from IPython.utils import py3compat
#-----------------------------------------------------------------------------
# Test functions begin
#-----------------------------------------------------------------------------
@dec.skip_win32
def test_console_starts():
"""test that `ipython console` starts a terminal"""
from IPython.external import pexpect
MinRK
Python 2.6 doesn't support `python -m IPython`...
r11358 args = ['console', '--colors=NoColor']
# FIXME: remove workaround for 2.6 support
if sys.version_info[:2] > (2,6):
args = ['-m', 'IPython'] + args
cmd = sys.executable
else:
cmd = 'ipython'
try:
p = pexpect.spawn(cmd, args=args)
except IOError:
raise SkipTest("Couldn't find command %s" % cmd)
MinRK
relax timeouts in pexpect console-frontend test...
r7646 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15)
Bradley M. Froehle
s/nt.assert_equals/nt.assert_equal/
r7875 nt.assert_equal(idx, 0, "expected in prompt")
MinRK
add single two-process terminal test
r5630 p.sendline('5')
MinRK
relax timeouts in pexpect console-frontend test...
r7646 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=5)
Bradley M. Froehle
s/nt.assert_equals/nt.assert_equal/
r7875 nt.assert_equal(idx, 0, "expected out prompt")
MinRK
relax timeouts in pexpect console-frontend test...
r7646 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=5)
Bradley M. Froehle
s/nt.assert_equals/nt.assert_equal/
r7875 nt.assert_equal(idx, 0, "expected second in prompt")
MinRK
add single two-process terminal test
r5630 # send ctrl-D;ctrl-D to exit
p.sendeof()
p.sendeof()
MinRK
relax timeouts in pexpect console-frontend test...
r7646 p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=5)
MinRK
add single two-process terminal test
r5630 if p.isalive():
p.terminate()