Show More
@@ -26,18 +26,11 b' class TestKernelManager(TestCase):' | |||||
26 | def _run_lifecycle(self, km): |
|
26 | def _run_lifecycle(self, km): | |
27 | km.start_kernel(stdout=PIPE, stderr=PIPE) |
|
27 | km.start_kernel(stdout=PIPE, stderr=PIPE) | |
28 | self.assertTrue(km.is_alive()) |
|
28 | self.assertTrue(km.is_alive()) | |
29 | km.restart_kernel() |
|
29 | km.restart_kernel(now=True) | |
30 | self.assertTrue(km.is_alive()) |
|
30 | self.assertTrue(km.is_alive()) | |
31 | # We need a delay here to give the restarting kernel a chance to |
|
|||
32 | # restart. Otherwise, the interrupt will kill it, causing the test |
|
|||
33 | # suite to hang. The reason it *hangs* is that the shutdown |
|
|||
34 | # message for the restart sometimes hasn't been sent to the kernel. |
|
|||
35 | # Because linger is oo on the shell channel, the context can't |
|
|||
36 | # close until the message is sent to the kernel, which is not dead. |
|
|||
37 | time.sleep(1.0) |
|
|||
38 | km.interrupt_kernel() |
|
31 | km.interrupt_kernel() | |
39 | self.assertTrue(isinstance(km, KernelManager)) |
|
32 | self.assertTrue(isinstance(km, KernelManager)) | |
40 | km.shutdown_kernel() |
|
33 | km.shutdown_kernel(now=True) | |
41 |
|
34 | |||
42 | def test_tcp_lifecycle(self): |
|
35 | def test_tcp_lifecycle(self): | |
43 | km = self._get_tcp_km() |
|
36 | km = self._get_tcp_km() |
@@ -31,20 +31,13 b' class TestKernelManager(TestCase):' | |||||
31 | self.assertTrue(kid in km) |
|
31 | self.assertTrue(kid in km) | |
32 | self.assertTrue(kid in km.list_kernel_ids()) |
|
32 | self.assertTrue(kid in km.list_kernel_ids()) | |
33 | self.assertEqual(len(km),1) |
|
33 | self.assertEqual(len(km),1) | |
34 | km.restart_kernel(kid) |
|
34 | km.restart_kernel(kid, now=True) | |
35 | self.assertTrue(km.is_alive(kid)) |
|
35 | self.assertTrue(km.is_alive(kid)) | |
36 | self.assertTrue(kid in km.list_kernel_ids()) |
|
36 | self.assertTrue(kid in km.list_kernel_ids()) | |
37 | # We need a delay here to give the restarting kernel a chance to |
|
|||
38 | # restart. Otherwise, the interrupt will kill it, causing the test |
|
|||
39 | # suite to hang. The reason it *hangs* is that the shutdown |
|
|||
40 | # message for the restart sometimes hasn't been sent to the kernel. |
|
|||
41 | # Because linger is oo on the shell channel, the context can't |
|
|||
42 | # close until the message is sent to the kernel, which is not dead. |
|
|||
43 | time.sleep(1.0) |
|
|||
44 | km.interrupt_kernel(kid) |
|
37 | km.interrupt_kernel(kid) | |
45 | k = km.get_kernel(kid) |
|
38 | k = km.get_kernel(kid) | |
46 | self.assertTrue(isinstance(k, KernelManager)) |
|
39 | self.assertTrue(isinstance(k, KernelManager)) | |
47 | km.shutdown_kernel(kid) |
|
40 | km.shutdown_kernel(kid, now=True) | |
48 | self.assertTrue(not kid in km) |
|
41 | self.assertTrue(not kid in km) | |
49 |
|
42 | |||
50 | def _run_cinfo(self, km, transport, ip): |
|
43 | def _run_cinfo(self, km, transport, ip): | |
@@ -63,7 +56,7 b' class TestKernelManager(TestCase):' | |||||
63 | self.assertTrue('hb_port' in cinfo) |
|
56 | self.assertTrue('hb_port' in cinfo) | |
64 | stream = km.connect_hb(kid) |
|
57 | stream = km.connect_hb(kid) | |
65 | stream.close() |
|
58 | stream.close() | |
66 | km.shutdown_kernel(kid) |
|
59 | km.shutdown_kernel(kid, now=True) | |
67 |
|
60 | |||
68 | def test_tcp_lifecycle(self): |
|
61 | def test_tcp_lifecycle(self): | |
69 | km = self._get_tcp_km() |
|
62 | km = self._get_tcp_km() |
General Comments 0
You need to be logged in to leave comments.
Login now