##// END OF EJS Templates
Merge pull request #1155 from minrk/postexec...
Merge pull request #1155 from minrk/postexec Be less aggressive in de-registering failing post-execute functions so that normal errors don't disable them permanently. Two changes: 1. Don't unregister failing post-exec callbacks automatically. Instead, print a message regarding the failure, pointing to new `disable_failing_post_execute` trait for skipping failing callbacks. - When this flag is False (the default), failing callbacks will continue to be called. - When True, behavior is unchanged from previous, where callbacks are only allowed to fail once. 2. protect `flush_figures()` post-exec function from user error. Invalid matplotlib data may raise inside `print_figure()`. flush_figures() is a post-exec function, so user errors should not raise. Instead, call `get_ipython().showtraceback()` if called from IPython, raising as before otherwise. closes #1154

File last commit:

r5629:ba0b0dbd
r5737:2c683b72 merge
Show More
test_kernelsession.py
27 lines | 819 B | text/x-python | PythonLexer
"""Tests for the notebook kernel and session manager."""
from unittest import TestCase
from IPython.frontend.html.notebook.kernelmanager import MultiKernelManager
class TestKernelManager(TestCase):
def test_km_lifecycle(self):
km = MultiKernelManager()
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(kid)
km.kill_kernel(kid)