Show More
@@ -1,6 +1,6 | |||||
1 | """Tests for two-process terminal frontend |
|
1 | """Tests for two-process terminal frontend | |
2 |
|
2 | |||
3 |
Curren |
|
3 | Currently only has the most simple test possible, starting a console and running | |
4 | a single command. |
|
4 | a single command. | |
5 |
|
5 | |||
6 | Authors: |
|
6 | Authors: | |
@@ -12,6 +12,7 Authors: | |||||
12 | # Imports |
|
12 | # Imports | |
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 |
|
14 | |||
|
15 | import sys | |||
15 | import time |
|
16 | import time | |
16 |
|
17 | |||
17 | import nose.tools as nt |
|
18 | import nose.tools as nt | |
@@ -30,19 +31,7 def test_console_starts(): | |||||
30 | """test that `ipython console` starts a terminal""" |
|
31 | """test that `ipython console` starts a terminal""" | |
31 | from IPython.external import pexpect |
|
32 | from IPython.external import pexpect | |
32 |
|
33 | |||
33 | # weird IOErrors prevent this from firing sometimes: |
|
34 | p = pexpect.spawn(sys.executable, args=['-m', 'IPython', 'console', '--colors=NoColor']) | |
34 | ipython_cmd = None |
|
|||
35 | for i in range(5): |
|
|||
36 | try: |
|
|||
37 | ipython_cmd = find_cmd('ipython3' if py3compat.PY3 else 'ipython') |
|
|||
38 | except IOError: |
|
|||
39 | time.sleep(0.1) |
|
|||
40 | else: |
|
|||
41 | break |
|
|||
42 | if ipython_cmd is None: |
|
|||
43 | raise SkipTest("Could not determine ipython command") |
|
|||
44 |
|
||||
45 | p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor']) |
|
|||
46 | idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15) |
|
35 | idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15) | |
47 | nt.assert_equal(idx, 0, "expected in prompt") |
|
36 | nt.assert_equal(idx, 0, "expected in prompt") | |
48 | p.sendline('5') |
|
37 | p.sendline('5') |
General Comments 0
You need to be logged in to leave comments.
Login now