File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,36 @@ def test_ipython_start_kernel_userns():
5050 assert EXPECTED in text
5151
5252
53+ def test_start_kernel_background_thread ():
54+
55+ cmd = dedent (
56+ """
57+ import threading
58+ from ipykernel.kernelapp import launch_new_instance
59+
60+ def launch():
61+ launch_new_instance()
62+
63+ thread = threading.Thread(target=launch)
64+ thread.start()
65+ thread.join()
66+ """
67+ )
68+
69+ with setup_kernel (cmd ) as client :
70+ client .execute ("a = 1" )
71+ msg = client .get_shell_msg (timeout = TIMEOUT )
72+ content = msg ["content" ]
73+ assert content ["status" ] == "ok"
74+
75+ client .inspect ("a" )
76+ msg = client .get_shell_msg (timeout = TIMEOUT )
77+ content = msg ["content" ]
78+ assert content ["found" ]
79+ text = content ["data" ]["text/plain" ]
80+ assert "1" in text
81+
82+
5383@pytest .mark .flaky (max_runs = 3 )
5484def test_ipython_start_kernel_no_userns ():
5585 # Issue #4188 - user_ns should be passed to shell as None, not {}
You can’t perform that action at this time.
0 commit comments