Skip to content

Commit ef46056

Browse files
committed
Debug
1 parent 40af2b0 commit ef46056

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

tests/test_subshells.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111
from jupyter_client.blocking.client import BlockingKernelClient
1212

13-
from .utils import TIMEOUT, get_replies, get_reply, new_kernel, wait_for_idle
13+
from .utils import TIMEOUT, assemble_output, get_replies, get_reply, new_kernel, wait_for_idle
1414

1515
# Helpers
1616

@@ -52,20 +52,8 @@ def execute_request(kc: BlockingKernelClient, code: str, subshell_id: str | None
5252
def execute_request_subshell_id(
5353
kc: BlockingKernelClient, code: str, subshell_id: str | None, terminator: str = "\n"
5454
):
55-
msg = execute_request(kc, code, subshell_id)
56-
msg_id = msg["msg_id"]
57-
stdout = ""
58-
while True:
59-
msg = kc.get_iopub_msg()
60-
# Get the stream messages corresponding to msg_id
61-
if (
62-
msg["msg_type"] == "stream"
63-
and msg["parent_header"]["msg_id"] == msg_id
64-
and msg["content"]["name"] == "stdout"
65-
):
66-
stdout += msg["content"]["text"]
67-
if stdout.endswith(terminator):
68-
break
55+
execute_request(kc, code, subshell_id)
56+
stdout, _ = assemble_output(kc.get_iopub_msg, None)
6957
return stdout.strip()
7058

7159

0 commit comments

Comments
 (0)