Skip to content

Commit dc352ba

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 dc352ba

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ipykernel/tests/test_start_kernel.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
@flaky(max_runs=3)
88
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)')
9+
cmd = """
10+
from ipykernel.kernelapp import launch_new_instance
11+
ns = {"tre": 123}
12+
launch_new_instance(user_ns=ns)
13+
"""
1214

1315
with setup_kernel(cmd) as client:
1416
client.inspect("tre")
@@ -34,8 +36,10 @@ def test_ipython_start_kernel_userns():
3436
@flaky(max_runs=3)
3537
def test_ipython_start_kernel_no_userns():
3638
# Issue #4188 - user_ns should be passed to shell as None, not {}
37-
cmd = ('from IPython import start_kernel\n'
38-
'start_kernel()')
39+
cmd = """
40+
from ipykernel.kernelapp import launch_new_instance
41+
launch_new_instance()
42+
"""
3943

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

0 commit comments

Comments
 (0)