Skip to content

Commit

Permalink
Add test for Jep jupyter#65
Browse files Browse the repository at this point in the history
  • Loading branch information
Hind-M committed Jul 11, 2023
1 parent 2ed849d commit 1cd61b9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions jupyter_kernel_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,31 @@ 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()

def test_recv_iopub_welcome_msg(self):
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;

0 comments on commit 1cd61b9

Please sign in to comment.