Show More
@@ -50,7 +50,7 b' def flush_channels(km=None):' | |||||
50 | if km is None: |
|
50 | if km is None: | |
51 | km = KM |
|
51 | km = KM | |
52 | """flush any messages waiting on the queue""" |
|
52 | """flush any messages waiting on the queue""" | |
53 |
for channel in ( |
|
53 | for channel in (km.shell_channel, km.iopub_channel): | |
54 | while True: |
|
54 | while True: | |
55 | try: |
|
55 | try: | |
56 | msg = channel.get_msg(block=True, timeout=0.1) |
|
56 | msg = channel.get_msg(block=True, timeout=0.1) |
@@ -108,14 +108,14 b' def _check_mp_mode(km, expected=False, stream="stdout"):' | |||||
108 | execute(km=km, code="import sys") |
|
108 | execute(km=km, code="import sys") | |
109 | flush_channels(km) |
|
109 | flush_channels(km) | |
110 | msg_id, content = execute(km=km, code="print (sys.%s._check_mp_mode())" % stream) |
|
110 | msg_id, content = execute(km=km, code="print (sys.%s._check_mp_mode())" % stream) | |
111 |
stdout, stderr = assemble_output(km. |
|
111 | stdout, stderr = assemble_output(km.iopub_channel) | |
112 | nt.assert_equal(eval(stdout.strip()), expected) |
|
112 | nt.assert_equal(eval(stdout.strip()), expected) | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | def test_simple_print(): |
|
115 | def test_simple_print(): | |
116 | """simple print statement in kernel""" |
|
116 | """simple print statement in kernel""" | |
117 | with new_kernel() as km: |
|
117 | with new_kernel() as km: | |
118 |
iopub = km. |
|
118 | iopub = km.iopub_channel | |
119 | msg_id, content = execute(km=km, code="print ('hi')") |
|
119 | msg_id, content = execute(km=km, code="print ('hi')") | |
120 | stdout, stderr = assemble_output(iopub) |
|
120 | stdout, stderr = assemble_output(iopub) | |
121 | nt.assert_equal(stdout, 'hi\n') |
|
121 | nt.assert_equal(stdout, 'hi\n') | |
@@ -127,7 +127,7 b' def test_simple_print():' | |||||
127 | def test_subprocess_print(): |
|
127 | def test_subprocess_print(): | |
128 | """printing from forked mp.Process""" |
|
128 | """printing from forked mp.Process""" | |
129 | with new_kernel() as km: |
|
129 | with new_kernel() as km: | |
130 |
iopub = km. |
|
130 | iopub = km.iopub_channel | |
131 |
|
131 | |||
132 | _check_mp_mode(km, expected=False) |
|
132 | _check_mp_mode(km, expected=False) | |
133 | flush_channels(km) |
|
133 | flush_channels(km) | |
@@ -158,7 +158,7 b' def test_subprocess_print():' | |||||
158 | def test_subprocess_noprint(): |
|
158 | def test_subprocess_noprint(): | |
159 | """mp.Process without print doesn't trigger iostream mp_mode""" |
|
159 | """mp.Process without print doesn't trigger iostream mp_mode""" | |
160 | with new_kernel() as km: |
|
160 | with new_kernel() as km: | |
161 |
iopub = km. |
|
161 | iopub = km.iopub_channel | |
162 |
|
162 | |||
163 | np = 5 |
|
163 | np = 5 | |
164 | code = '\n'.join([ |
|
164 | code = '\n'.join([ | |
@@ -182,7 +182,7 b' def test_subprocess_noprint():' | |||||
182 | def test_subprocess_error(): |
|
182 | def test_subprocess_error(): | |
183 | """error in mp.Process doesn't crash""" |
|
183 | """error in mp.Process doesn't crash""" | |
184 | with new_kernel() as km: |
|
184 | with new_kernel() as km: | |
185 |
iopub = km. |
|
185 | iopub = km.iopub_channel | |
186 |
|
186 | |||
187 | code = '\n'.join([ |
|
187 | code = '\n'.join([ | |
188 | "import multiprocessing as mp", |
|
188 | "import multiprocessing as mp", |
General Comments 0
You need to be logged in to leave comments.
Login now