Skip to content

Commit 4715b9b

Browse files
committed
IPython's start_kernel is deprecated.
Technically it has been deprecated since 5.0 but indirectly as it imports from IPython.kernel with itself is a shim module that exposes ipykernel. So it is useless to call into IPython if it's for calling back into ipykernel. Though the start_kernel itself was not emitting a deprecation warning, which will be the case in 8.0, and hopefully we can finish removing the shim modules later.
1 parent 587f45c commit 4715b9b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ipykernel/tests/test_start_kernel.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
from .test_embed_kernel import setup_kernel
22
from flaky import flaky
3+
from textwrap import dedent
34

45
TIMEOUT = 15
56

67

78
@flaky(max_runs=3)
89
def test_ipython_start_kernel_userns():
9-
cmd = ('from IPython import start_kernel\n'
10-
'ns = {"tre": 123}\n'
11-
'start_kernel(user_ns=ns)')
10+
cmd = dedent(
11+
"""
12+
from ipykernel.kernelapp import launch_new_instance
13+
ns = {"tre": 123}
14+
launch_new_instance(user_ns=ns)
15+
"""
16+
)
1217

1318
with setup_kernel(cmd) as client:
1419
client.inspect("tre")
@@ -34,8 +39,12 @@ def test_ipython_start_kernel_userns():
3439
@flaky(max_runs=3)
3540
def test_ipython_start_kernel_no_userns():
3641
# Issue #4188 - user_ns should be passed to shell as None, not {}
37-
cmd = ('from IPython import start_kernel\n'
38-
'start_kernel()')
42+
cmd = dedent(
43+
"""
44+
from ipykernel.kernelapp import launch_new_instance
45+
launch_new_instance()
46+
"""
47+
)
3948

4049
with setup_kernel(cmd) as client:
4150
# user_module should not be an instance of DummyMod

0 commit comments

Comments
 (0)