##// END OF EJS Templates
remove useless classes
remove useless classes

File last commit:

r7875:2549896b
r9264:f8b7b641
Show More
test_console.py
59 lines | 1.8 KiB | text/x-python | PythonLexer
MinRK
add single two-process terminal test
r5630 """Tests for two-process terminal frontend
Currenlty only has the most simple test possible, starting a console and running
a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import time
import nose.tools as nt
from nose import SkipTest
from IPython.testing import decorators as dec
from IPython.testing import tools as tt
from IPython.utils import py3compat
from IPython.utils.process import find_cmd
#-----------------------------------------------------------------------------
# Test functions begin
#-----------------------------------------------------------------------------
@dec.skip_win32
def test_console_starts():
"""test that `ipython console` starts a terminal"""
from IPython.external import pexpect
# weird IOErrors prevent this from firing sometimes:
ipython_cmd = None
for i in range(5):
try:
ipython_cmd = find_cmd('ipython3' if py3compat.PY3 else 'ipython')
except IOError:
time.sleep(0.1)
else:
break
if ipython_cmd is None:
raise SkipTest("Could not determine ipython command")
p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor'])
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()