Repository: ipython/ipykernel

Issue:
cell_id required in do_execute
Hi there,

Not exactly sure whether the issue is here or in spyder-kernels (reported there too as https://github.com/spyder-ide/spyder-kernels/issues/380), but running the spyder-kernels test suite with ipykernel 6.11 results in this:
```python
_______________________ ERROR at teardown of test_magics _______________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________________ ERROR at teardown of test_get_namespace_view _________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________________ ERROR at teardown of test_get_var_properties _________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_get_value ______________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_set_value ______________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
____________________ ERROR at teardown of test_remove_value ____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_copy_value _____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
________________ ERROR at teardown of test_load_npz_data[load0] ________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
________________ ERROR at teardown of test_load_npz_data[load1] ________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_load_data ______________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
___________________ ERROR at teardown of test_save_namespace ___________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_is_defined _____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
______________________ ERROR at teardown of test_get_doc _______________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_____________________ ERROR at teardown of test_get_source _____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
______________ ERROR at teardown of test_output_from_c_libraries _______________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
____________________ ERROR at teardown of test_np_threshold ____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________________ ERROR at teardown of test_matplotlib_inline __________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
____________________ ERROR at teardown of test_do_complete _____________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
__________ ERROR at teardown of test_callables_and_modules[True-True] __________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________ ERROR at teardown of test_callables_and_modules[True-False] __________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________ ERROR at teardown of test_callables_and_modules[False-True] __________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________ ERROR at teardown of test_callables_and_modules[False-False] _________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________ ERROR at teardown of test_comprehensions_with_locals_in_pdb __________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
________ ERROR at teardown of test_comprehensions_with_locals_in_pdb_2 _________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_________________ ERROR at teardown of test_namespaces_in_pdb __________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
----------------------------- Captured stdout call -----------------------------
17.2 ns ± 0.0216 ns per loop (mean ± std. dev. of 7 runs, 100,000,000 loops each)
16.7 ns ± 0.0371 ns per loop (mean ± std. dev. of 7 runs, 100,000,000 loops each)
("NameError: name 'test' is not defined",) {}
*** NameError: name 'test' is not defined
____________ ERROR at teardown of test_functions_with_locals_in_pdb ____________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
___________ ERROR at teardown of test_functions_with_locals_in_pdb_2 ___________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
_______________ ERROR at teardown of test_locals_globals_in_pdb ________________

    def reset_kernel():
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('reset -f', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:144: TypeError
=================================== FAILURES ===================================
___________________________ test_get_namespace_view ____________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbfa36b460>

    def test_get_namespace_view(kernel):
        """
        Test the namespace view of the kernel.
        """
        if IPYKERNEL_6:
>           execute = asyncio.run(kernel.do_execute('a = 1', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:192: TypeError
___________________________ test_get_var_properties ____________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf899c1c0>

    def test_get_var_properties(kernel):
        """
        Test the properties fo the variables in the namespace.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('a = 1', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:214: TypeError
________________________________ test_get_value ________________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf899d600>

    def test_get_value(kernel):
        """Test getting the value of a variable."""
        name = 'a'
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute("a = 124", True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:235: TypeError
________________________________ test_set_value ________________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a67fa0>

    def test_set_value(kernel):
        """Test setting the value of a variable."""
        name = 'a'
        if IPYKERNEL_6:
>            asyncio.run(kernel.do_execute('a = 0', True))
E            TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:247: TypeError
______________________________ test_remove_value _______________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a652d0>

    def test_remove_value(kernel):
        """Test the removal of a variable."""
        name = 'a'
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('a = 1', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:264: TypeError
_______________________________ test_copy_value ________________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a667d0>

    def test_copy_value(kernel):
        """Test the copy of a variable."""
        orig_name = 'a'
        new_name = 'b'
        if IPYKERNEL_6:
>            asyncio.run(kernel.do_execute('a = 1', True))
E            TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:289: TypeError
__________________________ test_load_npz_data[load0] ___________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf899e0b0>
load = (True, 'val1 = 0', {'val1': array(1)})

    @pytest.mark.parametrize(
        "load", [(True, "val1 = 0", {"val1": np.array(1)}),
                 (False, "val1 = 0", {"val1": 0, "val1_000": np.array(1)})])
    def test_load_npz_data(kernel, load):
        """Test loading data from npz filename."""
        namespace_file = osp.join(FILES_PATH, 'load_data.npz')
        extention = '.npz'
        overwrite, execute, variables = load
    
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute(execute, True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:329: TypeError
__________________________ test_load_npz_data[load1] ___________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a45420>
load = (False, 'val1 = 0', {'val1': 0, 'val1_000': array(1)})

    @pytest.mark.parametrize(
        "load", [(True, "val1 = 0", {"val1": np.array(1)}),
                 (False, "val1 = 0", {"val1": 0, "val1_000": np.array(1)})])
    def test_load_npz_data(kernel, load):
        """Test loading data from npz filename."""
        namespace_file = osp.join(FILES_PATH, 'load_data.npz')
        extention = '.npz'
        overwrite, execute, variables = load
    
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute(execute, True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:329: TypeError
_____________________________ test_save_namespace ______________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a44a30>

    def test_save_namespace(kernel):
        """Test saving the namespace into filename."""
        namespace_file = osp.join(FILES_PATH, 'save_data.spydata')
    
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('b = 1', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:361: TypeError
_________________________ test_output_from_c_libraries _________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8283160>
capsys = <_pytest.capture.CaptureFixture object at 0x7efbf8282f20>

    @pytest.mark.skipif(os.name == 'nt', reason="Doesn't work on Windows")
    def test_output_from_c_libraries(kernel, capsys):
        """Test that the wurlitzer extension is working."""
        # This code was taken from the Wurlitzer demo
        code = """
    import ctypes
    libc = ctypes.CDLL(None)
    libc.printf(('Hello from C\\n').encode('utf8'))
    """
    
        # With Wurlitzer we have the expected output
        kernel._load_wurlitzer()
    
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute(code, True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:409: TypeError
_______________________________ test_do_complete _______________________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8a47ac0>

    def test_do_complete(kernel):
        """
        Check do complete works in normal and debugging mode.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('abba = 1', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:824: TypeError
____________________ test_callables_and_modules[True-True] _____________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf8311ff0>
exclude_callables_and_modules = True, exclude_unsupported = True

    @pytest.mark.parametrize("exclude_callables_and_modules", [True, False])
    @pytest.mark.parametrize("exclude_unsupported", [True, False])
    def test_callables_and_modules(kernel, exclude_callables_and_modules,
                                   exclude_unsupported):
        """
        Tests that callables and modules are in the namespace view only
        when the right options are passed to the kernel.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('import numpy', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:850: TypeError
____________________ test_callables_and_modules[True-False] ____________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf81ed600>
exclude_callables_and_modules = False, exclude_unsupported = True

    @pytest.mark.parametrize("exclude_callables_and_modules", [True, False])
    @pytest.mark.parametrize("exclude_unsupported", [True, False])
    def test_callables_and_modules(kernel, exclude_callables_and_modules,
                                   exclude_unsupported):
        """
        Tests that callables and modules are in the namespace view only
        when the right options are passed to the kernel.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('import numpy', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:850: TypeError
____________________ test_callables_and_modules[False-True] ____________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf817b880>
exclude_callables_and_modules = True, exclude_unsupported = False

    @pytest.mark.parametrize("exclude_callables_and_modules", [True, False])
    @pytest.mark.parametrize("exclude_unsupported", [True, False])
    def test_callables_and_modules(kernel, exclude_callables_and_modules,
                                   exclude_unsupported):
        """
        Tests that callables and modules are in the namespace view only
        when the right options are passed to the kernel.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('import numpy', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:850: TypeError
___________________ test_callables_and_modules[False-False] ____________________

kernel = <spyder_kernels.console.kernel.SpyderKernel object at 0x7efbf81ec0a0>
exclude_callables_and_modules = False, exclude_unsupported = False

    @pytest.mark.parametrize("exclude_callables_and_modules", [True, False])
    @pytest.mark.parametrize("exclude_unsupported", [True, False])
    def test_callables_and_modules(kernel, exclude_callables_and_modules,
                                   exclude_unsupported):
        """
        Tests that callables and modules are in the namespace view only
        when the right options are passed to the kernel.
        """
        if IPYKERNEL_6:
>           asyncio.run(kernel.do_execute('import numpy', True))
E           TypeError: IPythonKernel.do_execute() missing 1 required keyword-only argument: 'cell_id'

spyder_kernels/console/tests/test_console_kernel.py:850: TypeError
```
The offending change was added in [this commit](https://github.com/ipython/ipykernel/commit/c0bfd45c1499ffd4ce5f642862c76b3aaf90e765) (PR #886).

Discussion:

Patch:
diff --git a/ipykernel/ipkernel.py b/ipykernel/ipkernel.py
index 77ee7bf..3c69597 100644
--- a/ipykernel/ipkernel.py
+++ b/ipykernel/ipkernel.py
@@ -304,7 +304,7 @@ class IPythonKernel(KernelBase):
         user_expressions=None,
         allow_stdin=False,
         *,
-        cell_id,
+        cell_id=None,
     ):
         shell = self.shell  # we'll need this a lot here
 
diff --git a/ipykernel/kernelbase.py b/ipykernel/kernelbase.py
index 4922460..7c80afd 100644
--- a/ipykernel/kernelbase.py
+++ b/ipykernel/kernelbase.py
@@ -749,7 +749,14 @@ class Kernel(SingletonConfigurable):
             self._abort_queues()
 
     def do_execute(
-        self, code, silent, store_history=True, user_expressions=None, allow_stdin=False
+        self,
+        code,
+        silent,
+        store_history=True,
+        user_expressions=None,
+        allow_stdin=False,
+        *,
+        cell_id=None,
     ):
         """Execute user code. Must be overridden by subclasses."""
         raise NotImplementedError
diff --git a/pyproject.toml b/pyproject.toml
index bb62a37..7690548 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,9 +30,9 @@ tag_template = "v{new_version}"
 src = "ipykernel/_version.py"
 
 [tool.pytest.ini_options]
-addopts = "-raXs --durations 10 --color=yes --doctest-modules"
+addopts = "-raXs --durations 10 --color=yes --doctest-modules --ignore=ipykernel/pylab/backend_inline.py --ignore=ipykernel/pylab/config.py --ignore=ipykernel/gui/gtk3embed.py --ignore=ipykernel/gui/gtkembed.py --ignore=ipykernel/datapub.py --ignore=ipykernel/log.py --ignore=ipykernel/pickleutil.py --ignore=ipykernel/serialize.py --ignore=ipykernel/_eventloop_macos.py"
 testpaths = [
-    "ipykernel/tests/"
+    "ipykernel/"
 ]
 timeout = 300
 # Restore this setting to debug failures
@@ -41,6 +41,12 @@ filterwarnings= [
   # Fail on warnings
   "error",
 
+  # Ignore our own warnings
+  "ignore:The `stream` parameter of `getpass.getpass` will have no effect:UserWarning",
+
+  # https://github.com/minrk/appnope/issues/13
+  "ignore:distutils Version classes are deprecated:DeprecationWarning:appnope",
+
   # Ignore jupyter_client warnings
   "ignore:unclosed <socket.socket:ResourceWarning",
   "ignore:unclosed event loop:ResourceWarning",
diff --git a/setup.py b/setup.py
index 9c626e4..da31531 100644
--- a/setup.py
+++ b/setup.py
@@ -81,6 +81,8 @@ setup_args = dict(
             "ipyparallel",
             "pre-commit",
             "pytest-timeout",
+            "gobject",
+            "trio",
         ],
     },
     classifiers=[


Test patch:
diff --git a/ipykernel/inprocess/tests/test_kernel.py b/ipykernel/inprocess/tests/test_kernel.py
index ed9a5aa..2a2311f 100644
--- a/ipykernel/inprocess/tests/test_kernel.py
+++ b/ipykernel/inprocess/tests/test_kernel.py
@@ -1,6 +1,7 @@
 # Copyright (c) IPython Development Team.
 # Distributed under the terms of the Modified BSD License.
 
+import asyncio
 import sys
 import unittest
 from contextlib import contextmanager
@@ -148,3 +149,8 @@ class InProcessKernelTestCase(unittest.TestCase):
         kernel._input_request = lambda *args, **kwargs: None
 
         kernel.getpass(stream="non empty")
+
+    def test_do_execute(self):
+        kernel = InProcessKernel()
+        asyncio.run(kernel.do_execute("a=1", True))
+        assert kernel.shell.user_ns["a"] == 1