Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pass None kernels to logging configurable in Comm #1061

Merged
merged 6 commits into from Dec 20, 2022

Conversation

bollwyvl
Copy link
Contributor

References

Changes

  • doesn't pass kernel=None values to LoggingConfigurable.__init__

@maartenbreddels
Copy link
Contributor

Let me add a test for this, so we can pour this in concrete.

@maartenbreddels
Copy link
Contributor

From aa0693490a00f8c3ac13f64d92d45012de03c04f Mon Sep 17 00:00:00 2001
From: "Maarten A. Breddels" <maartenbreddels@gmail.com>
Date: Tue, 20 Dec 2022 15:39:04 +0100
Subject: [PATCH] test: make sure comms have the correct kernel

---
 ipykernel/tests/test_comm.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ipykernel/tests/test_comm.py b/ipykernel/tests/test_comm.py
index 405841f..44a30a5 100644
--- a/ipykernel/tests/test_comm.py
+++ b/ipykernel/tests/test_comm.py
@@ -2,6 +2,7 @@ import unittest.mock
 
 from ipykernel.comm import Comm, CommManager
 from ipykernel.ipkernel import IPythonKernel
+from ipykernel.kernelbase import Kernel
 
 
 def test_comm(kernel):
@@ -11,6 +12,8 @@ def test_comm(kernel):
     c = Comm(kernel=kernel, target_name="bar")
     msgs = []
 
+    assert kernel is c.kernel
+
     def on_close(msg):
         msgs.append(msg)
 
@@ -56,6 +59,11 @@ def test_comm_manager(kernel):
         manager.register_comm(comm)
         assert publish_msg.call_count == 1
 
+    # make sure that when we don't pass a kernel, the 'default' kernel is taken
+    Kernel._instance = kernel
+    assert comm.kernel is kernel
+    Kernel.clear_instance()
+
     assert manager.get_comm(comm.comm_id) == comm
     assert manager.get_comm('foo') is None
 
-- 
2.37.1 (Apple Git-137.1)

@maartenbreddels
Copy link
Contributor

Btw, I checked, and indeed the test fails on the current main (2c66b2d)

@bollwyvl
Copy link
Contributor Author

patched! 🧦

@maartenbreddels
Copy link
Contributor

sorry for the lint issue :)

@bollwyvl
Copy link
Contributor Author

is there a bot command to add a label... or can someone? It's annoying to get the ❌ immediately, makes the browser tab status icon worthless.

@blink1073
Copy link
Member

We'd have to add config similar to https://github.com/jupyterlab/jupyterlab/blob/master/.meeseeksdev.yml to enable that.

@blink1073 blink1073 added the bug label Dec 20, 2022
@blink1073 blink1073 enabled auto-merge (squash) December 20, 2022 16:12
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blink1073 blink1073 merged commit 07da48e into ipython:main Dec 20, 2022
@bollwyvl
Copy link
Contributor Author

thanks for the assist

@bollwyvl bollwyvl deleted the gh-1060-no-none-kernel branch December 20, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't update children trait after widget is displayed.
3 participants