##// END OF EJS Templates
Removing default input prompt number....
Removing default input prompt number. In a notebook setting being able to delete and add cells makes it virtually impossible to correctly guess what the next input prompt number should be. We now follow the convention that our prompts look like "In [ ]:" before execution.

File last commit:

r4344:9ce48758
r4391:b1f1ddea
Show More
test_kernelsession.py
39 lines | 1.2 KiB | text/x-python | PythonLexer
Brian E. Granger
Refactoring the notebook app to support the new config system.
r4344 """Tests for the notebook kernel and session manager."""
Brian E. Granger
Refactored htmlnotebook session and kernel manager....
r4343
from unittest import TestCase
from IPython.frontend.html.notebook.kernelmanager import KernelManager
from IPython.frontend.html.notebook.sessionmanager import SessionManagerRunningError
class TestKernelManager(TestCase):
def test_km_lifecycle(self):
km = KernelManager()
kid = km.start_kernel()
self.assert_(kid in km)
self.assertEquals(len(km),1)
km.kill_kernel(kid)
self.assert_(not kid in km)
kid = km.start_kernel()
self.assertEquals('127.0.0.1',km.get_kernel_ip(kid))
port_dict = km.get_kernel_ports(kid)
self.assert_('stdin_port' in port_dict)
self.assert_('iopub_port' in port_dict)
self.assert_('shell_port' in port_dict)
self.assert_('hb_port' in port_dict)
km.get_kernel_process(kid)
def test_session_manager(self):
km = KernelManager()
kid = km.start_kernel()
sm = km.create_session_manager(kid)
self.assert_(sm._running)
sm.stop()
self.assert_(not sm._running)
sm.start()
self.assertRaises(SessionManagerRunningError, sm.start)
sm.get_iopub_stream()
sm.get_shell_stream()
sm.session