Show More
@@ -46,7 +46,9 b' def teardown():' | |||||
46 | KM.shutdown_kernel() |
|
46 | KM.shutdown_kernel() | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | def flush_channels(): |
|
49 | def flush_channels(km=None): | |
|
50 | if km is None: | |||
|
51 | km = KM | |||
50 | """flush any messages waiting on the queue""" |
|
52 | """flush any messages waiting on the queue""" | |
51 | for channel in (KM.shell_channel, KM.iopub_channel): |
|
53 | for channel in (KM.shell_channel, KM.iopub_channel): | |
52 | while True: |
|
54 | while True: | |
@@ -58,10 +60,12 b' def flush_channels():' | |||||
58 | list(validate_message(msg)) |
|
60 | list(validate_message(msg)) | |
59 |
|
61 | |||
60 |
|
62 | |||
61 | def execute(code='', **kwargs): |
|
63 | def execute(code='', km=None, **kwargs): | |
62 | """wrapper for doing common steps for validating an execution request""" |
|
64 | """wrapper for doing common steps for validating an execution request""" | |
63 | shell = KM.shell_channel |
|
65 | if km is None: | |
64 | sub = KM.iopub_channel |
|
66 | km = KM | |
|
67 | shell = km.shell_channel | |||
|
68 | sub = km.iopub_channel | |||
65 |
|
69 | |||
66 | msg_id = shell.execute(code=code, **kwargs) |
|
70 | msg_id = shell.execute(code=code, **kwargs) | |
67 | reply = shell.get_msg(timeout=2) |
|
71 | reply = shell.get_msg(timeout=2) |
General Comments 0
You need to be logged in to leave comments.
Login now