##// END OF EJS Templates
test for text/plain display handling in console
Paul Ivanov -
Show More
@@ -61,3 +61,40 b' def test_help_output():'
61 """ipython console --help-all works"""
61 """ipython console --help-all works"""
62 tt.help_all_output_test('console')
62 tt.help_all_output_test('console')
63
63
64
65 def test_display_text():
66 "Ensure display protocol plain/text key is supported"
67 # equivalent of:
68 #
69 # x = %lsmagic
70 # from IPython.display import display; display(x);
71
72 from IPython.external import pexpect
73
74 args = ['console', '--colors=NoColor']
75 # FIXME: remove workaround for 2.6 support
76 if sys.version_info[:2] > (2,6):
77 args = ['-m', 'IPython'] + args
78 cmd = sys.executable
79 else:
80 cmd = 'ipython'
81
82 try:
83 p = pexpect.spawn(cmd, args=args)
84 except IOError:
85 raise SkipTest("Couldn't find command %s" % cmd)
86
87 # timeout after one minute
88 t = 60
89 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
90 p.sendline('x = %lsmagic')
91 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
92 p.sendline('from IPython.display import display; display(x);')
93 p.expect([r'Available line magics:', pexpect.EOF], timeout=t)
94
95 # send ctrl-D;ctrl-D to exit
96 p.sendeof()
97 p.sendeof()
98 p.expect([pexpect.EOF, pexpect.TIMEOUT], timeout=t)
99 if p.isalive():
100 p.terminate()
General Comments 0
You need to be logged in to leave comments. Login now