##// END OF EJS Templates
Merge pull request #4542 from ivanov/history-clear...
Merge pull request #4542 from ivanov/history-clear new `ipython history clear` subcommand This new subcommand is equivalent to ipython history trim --HistoryTrim.keep=0, which is now supported (and also has a more convenient --keep alias) This command comes with a fix to bash completion of flags for ipython history subcmd also included is a tiny fix for nbconvert completion that was pointed out by @jakobgager in #4528 also included is a change to our utils.io.ask_yes_no function that allows for specifying the behavior of a KeyboardInterrupt.

File last commit:

r12357:150bcc8a
r13694:24e10561 merge
Show More
test_console.py
63 lines | 1.7 KiB | text/x-python | PythonLexer
"""Tests for two-process terminal frontend
Currently only has the most simple test possible, starting a console and running
a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
import time
import nose.tools as nt
from nose import SkipTest
import IPython.testing.tools as tt
from IPython.testing import decorators as dec
from IPython.utils import py3compat
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
@dec.skip_win32
def test_console_starts():
"""test that `ipython console` starts a terminal"""
from IPython.external import pexpect
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)
# timeout after one minute
t = 60
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
p.sendline('5')
idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=t)
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
# send ctrl-D;ctrl-D to exit
p.sendeof()
p.sendeof()
p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=t)
if p.isalive():
p.terminate()
def test_help_output():
"""ipython console --help-all works"""
tt.help_all_output_test('console')