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

Add test for Jep #65 #134

Merged
merged 5 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions jupyter_kernel_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,38 @@ def test_clear_output(self):
if not found:
emsg = "clear_output message not found"
raise AssertionError(emsg)


class IopubWelcomeTests(TestCase):
kernel_name = "python3"
kc: BlockingKernelClient
km: KernelManager

@classmethod
def setUpClass(cls):
cls.km = KernelManager(kernel_name=cls.kernel_name)
cls.km.start_kernel()
cls.kc = cls.km.client()

@classmethod
def tearDownClass(cls):
cls.kc.stop_channels()
cls.km.shutdown_kernel()

support_iopub_welcome = False

def test_recv_iopub_welcome_msg(self):
if not self.support_iopub_welcome:
raise SkipTest("Iopub welcome messages are not supported") # noqa

self.kc.start_channels()
while True:
msg = self.kc.get_iopub_msg()
if msg:
self.assertEqual(msg["header"]["msg_type"], "iopub_welcome")
self.assertEqual(msg["msg_type"], "iopub_welcome")
self.assertEqual(
msg["content"]["subscription"], ""
) # Default: empty topic means subscription to all topics

break