Show More
@@ -0,0 +1,36 | |||||
|
1 | """Tests for the notebook kernel and session manager.""" | |||
|
2 | ||||
|
3 | from unittest import TestCase | |||
|
4 | ||||
|
5 | from IPython.config.loader import Config | |||
|
6 | from IPython.zmq.kernelmanager import KernelManager | |||
|
7 | ||||
|
8 | class TestKernelManager(TestCase): | |||
|
9 | ||||
|
10 | def _get_tcp_km(self): | |||
|
11 | return KernelManager() | |||
|
12 | ||||
|
13 | def _get_ipc_km(self): | |||
|
14 | c = Config() | |||
|
15 | c.KernelManager.transport = 'ipc' | |||
|
16 | c.KernelManager.ip = 'test' | |||
|
17 | km = KernelManager(config=c) | |||
|
18 | return km | |||
|
19 | ||||
|
20 | def _run_lifecycle(self, km): | |||
|
21 | km.start_kernel() | |||
|
22 | km.start_channels(shell=True, iopub=False, stdin=False, hb=False) | |||
|
23 | # km.shell_channel.start() | |||
|
24 | km.restart_kernel() | |||
|
25 | km.interrupt_kernel() | |||
|
26 | self.assertTrue(isinstance(km, KernelManager)) | |||
|
27 | km.shutdown_kernel() | |||
|
28 | km.shell_channel.stop() | |||
|
29 | ||||
|
30 | def test_km_tcp(self): | |||
|
31 | km = self._get_tcp_km() | |||
|
32 | self._run_lifecycle(km) | |||
|
33 | ||||
|
34 | def test_km_ipc(self): | |||
|
35 | km = self._get_ipc_km() | |||
|
36 | self._run_lifecycle(km) |
General Comments 0
You need to be logged in to leave comments.
Login now