Show More
@@ -22,7 +22,7 b' from subprocess import Popen, PIPE' | |||||
22 |
|
22 | |||
23 | import nose.tools as nt |
|
23 | import nose.tools as nt | |
24 |
|
24 | |||
25 |
from IPython.kernel |
|
25 | from IPython.kernel import BlockingKernelClient | |
26 | from IPython.utils import path, py3compat |
|
26 | from IPython.utils import path, py3compat | |
27 |
|
27 | |||
28 | #------------------------------------------------------------------------------- |
|
28 | #------------------------------------------------------------------------------- | |
@@ -83,14 +83,14 b' def setup_kernel(cmd):' | |||||
83 | kernel.terminate() |
|
83 | kernel.terminate() | |
84 | raise IOError("Connection file %r never arrived" % connection_file) |
|
84 | raise IOError("Connection file %r never arrived" % connection_file) | |
85 |
|
85 | |||
86 |
|
|
86 | client = BlockingKernelClient(connection_file=connection_file) | |
87 |
|
|
87 | client.load_connection_file() | |
88 |
|
|
88 | client.start_channels() | |
89 |
|
89 | |||
90 | try: |
|
90 | try: | |
91 |
yield |
|
91 | yield client | |
92 | finally: |
|
92 | finally: | |
93 |
|
|
93 | client.stop_channels() | |
94 | kernel.terminate() |
|
94 | kernel.terminate() | |
95 |
|
95 | |||
96 | def test_embed_kernel_basic(): |
|
96 | def test_embed_kernel_basic(): | |
@@ -105,8 +105,8 b' def test_embed_kernel_basic():' | |||||
105 | '', |
|
105 | '', | |
106 | ]) |
|
106 | ]) | |
107 |
|
107 | |||
108 |
with setup_kernel(cmd) as |
|
108 | with setup_kernel(cmd) as client: | |
109 |
shell = |
|
109 | shell = client.shell_channel | |
110 |
|
110 | |||
111 | # oinfo a (int) |
|
111 | # oinfo a (int) | |
112 | msg_id = shell.object_info('a') |
|
112 | msg_id = shell.object_info('a') | |
@@ -138,8 +138,8 b' def test_embed_kernel_namespace():' | |||||
138 | '', |
|
138 | '', | |
139 | ]) |
|
139 | ]) | |
140 |
|
140 | |||
141 |
with setup_kernel(cmd) as |
|
141 | with setup_kernel(cmd) as client: | |
142 |
shell = |
|
142 | shell = client.shell_channel | |
143 |
|
143 | |||
144 | # oinfo a (int) |
|
144 | # oinfo a (int) | |
145 | msg_id = shell.object_info('a') |
|
145 | msg_id = shell.object_info('a') | |
@@ -176,8 +176,8 b' def test_embed_kernel_reentrant():' | |||||
176 | '', |
|
176 | '', | |
177 | ]) |
|
177 | ]) | |
178 |
|
178 | |||
179 |
with setup_kernel(cmd) as |
|
179 | with setup_kernel(cmd) as client: | |
180 |
shell = |
|
180 | shell = client.shell_channel | |
181 | for i in range(5): |
|
181 | for i in range(5): | |
182 | msg_id = shell.object_info('count') |
|
182 | msg_id = shell.object_info('count') | |
183 | msg = shell.get_msg(block=True, timeout=2) |
|
183 | msg = shell.get_msg(block=True, timeout=2) |
General Comments 0
You need to be logged in to leave comments.
Login now