Show More
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Tests for the notebook kernel and session manager.""" |
|
2 | 2 | |
|
3 | import time | |
|
3 | 4 | from unittest import TestCase |
|
4 | 5 | |
|
5 | 6 | from IPython.config.loader import Config |
@@ -25,6 +26,13 b' class TestKernelManager(TestCase):' | |||
|
25 | 26 | self.assertEqual(len(km),1) |
|
26 | 27 | km.restart_kernel(kid) |
|
27 | 28 | self.assertTrue(kid in km.list_kernel_ids()) |
|
29 | # We need a delay here to give the restarting kernel a chance to | |
|
30 | # restart. Otherwise, the interrupt will kill it, causing the test | |
|
31 | # suite to hang. The reason it *hangs* is that the shutdown | |
|
32 | # message for the restart sometimes hasn't been sent to the kernel. | |
|
33 | # Because linger is oo on the shell channel, the context can't | |
|
34 | # close until the message is sent to the kernel, which is not dead. | |
|
35 | time.sleep(1.0) | |
|
28 | 36 | km.interrupt_kernel(kid) |
|
29 | 37 | k = km.get_kernel(kid) |
|
30 | 38 | self.assertTrue(isinstance(k, KernelManager)) |
@@ -43,7 +51,7 b' class TestKernelManager(TestCase):' | |||
|
43 | 51 | self.assertTrue('hb_port' in cinfo) |
|
44 | 52 | km.shutdown_kernel(kid) |
|
45 | 53 | |
|
46 |
def test_ |
|
|
54 | def test_tcp_lifecycle(self): | |
|
47 | 55 | km = self._get_tcp_km() |
|
48 | 56 | self._run_lifecycle(km) |
|
49 | 57 | |
@@ -51,10 +59,11 b' class TestKernelManager(TestCase):' | |||
|
51 | 59 | km = self._get_tcp_km() |
|
52 | 60 | self._run_cinfo(km, 'tcp', '127.0.0.1') |
|
53 | 61 | |
|
54 |
def test_ |
|
|
62 | def test_ipc_lifecycle(self): | |
|
55 | 63 | km = self._get_ipc_km() |
|
56 | 64 | self._run_lifecycle(km) |
|
57 | 65 | |
|
58 | 66 | def test_ipc_cinfo(self): |
|
59 | 67 | km = self._get_ipc_km() |
|
60 | 68 | self._run_cinfo(km, 'ipc', 'test') |
|
69 |
@@ -201,7 +201,6 b' class ShellChannel(ZMQSocketChannel):' | |||
|
201 | 201 | """The thread's main activity. Call start() instead.""" |
|
202 | 202 | self.socket = self.context.socket(zmq.DEALER) |
|
203 | 203 | self.socket.setsockopt(zmq.IDENTITY, self.session.bsession) |
|
204 | self.socket.linger = 0 | |
|
205 | 204 | self.socket.connect(self.address) |
|
206 | 205 | self.stream = zmqstream.ZMQStream(self.socket, self.ioloop) |
|
207 | 206 | self.stream.on_recv(self._handle_recv) |
@@ -1,5 +1,6 b'' | |||
|
1 | 1 | """Tests for the notebook kernel and session manager.""" |
|
2 | 2 | |
|
3 | import time | |
|
3 | 4 | from unittest import TestCase |
|
4 | 5 | |
|
5 | 6 | from IPython.config.loader import Config |
@@ -20,17 +21,24 b' class TestKernelManager(TestCase):' | |||
|
20 | 21 | def _run_lifecycle(self, km): |
|
21 | 22 | km.start_kernel() |
|
22 | 23 | km.start_channels(shell=True, iopub=False, stdin=False, hb=False) |
|
23 | # km.shell_channel.start() | |
|
24 | 24 | km.restart_kernel() |
|
25 | # We need a delay here to give the restarting kernel a chance to | |
|
26 | # restart. Otherwise, the interrupt will kill it, causing the test | |
|
27 | # suite to hang. The reason it *hangs* is that the shutdown | |
|
28 | # message for the restart sometimes hasn't been sent to the kernel. | |
|
29 | # Because linger is oo on the shell channel, the context can't | |
|
30 | # close until the message is sent to the kernel, which is not dead. | |
|
31 | time.sleep() | |
|
25 | 32 | km.interrupt_kernel() |
|
26 | 33 | self.assertTrue(isinstance(km, KernelManager)) |
|
27 | 34 | km.shutdown_kernel() |
|
28 | 35 | km.shell_channel.stop() |
|
29 | 36 | |
|
30 |
def test_ |
|
|
37 | def test_tcp_lifecycle(self): | |
|
31 | 38 | km = self._get_tcp_km() |
|
32 | 39 | self._run_lifecycle(km) |
|
33 | 40 | |
|
34 |
def test |
|
|
41 | def testipc_lifecycle(self): | |
|
35 | 42 | km = self._get_ipc_km() |
|
36 | 43 | self._run_lifecycle(km) |
|
44 |
General Comments 0
You need to be logged in to leave comments.
Login now