##// END OF EJS Templates
Backport PR #4762: whitelist alphanumeric characters for cookie_name...
Backport PR #4762: whitelist alphanumeric characters for cookie_name should fix #4761

File last commit:

r12421:e9553a5f
r14006:012f8956
Show More
test_console.py
63 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
MinRK
Backport PR #4125: Basic exercise of `ipython [subcommand] -h` and help-all...
r12421 import IPython.testing.tools as tt
MinRK
add single two-process terminal test
r5630 from IPython.testing import decorators as dec
from IPython.utils import py3compat
#-----------------------------------------------------------------------------
MinRK
Backport PR #4125: Basic exercise of `ipython [subcommand] -h` and help-all...
r12421 # Tests
MinRK
add single two-process terminal test
r5630 #-----------------------------------------------------------------------------
@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
single timeout value for pexepect in test_console
r11796 # timeout after one minute
t = 60
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
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)
MinRK
add single two-process terminal test
r5630 # send ctrl-D;ctrl-D to exit
p.sendeof()
p.sendeof()
MinRK
single timeout value for pexepect in test_console
r11796 p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=t)
MinRK
add single two-process terminal test
r5630 if p.isalive():
p.terminate()
MinRK
Backport PR #4125: Basic exercise of `ipython [subcommand] -h` and help-all...
r12421
def test_help_output():
"""ipython console --help-all works"""
tt.help_all_output_test('console')