##// END OF EJS Templates
Remove EventManager reset methods, because they violate encapsulation....
Remove EventManager reset methods, because they violate encapsulation. The whole idea of the EventManager is that you can register hooks without worrying about what hooks other pieces of code might be registering. The reset methods violate this separation of concerns, since they will blow away everyone else's hooks too. (See gh-6680 for an example of this breaking things.) Since there is never any safe way to use them, we simply remove them entirely.

File last commit:

r16587:7f1fdd0c
r18547:4043b271
Show More
test_start_kernel.py
48 lines | 1.8 KiB | text/x-python | PythonLexer
/ IPython / kernel / zmq / tests / test_start_kernel.py
Thomas Kluyver
Add test for IPython.start_kernel()
r12182 import nose.tools as nt
from .test_embed_kernel import setup, teardown, setup_kernel
TIMEOUT = 15
def test_ipython_start_kernel_userns():
cmd = ('from IPython import start_kernel\n'
'ns = {"tre": 123}\n'
'start_kernel(user_ns=ns)')
Thomas Kluyver
Add a test for kernel started without user_ns kwarg....
r12477
Thomas Kluyver
Add test for IPython.start_kernel()
r12182 with setup_kernel(cmd) as client:
MinRK
s/object_info_request/inspect_request
r16587 msg_id = client.inspect('tre')
Thomas Kluyver
Add test for IPython.start_kernel()
r12182 msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
content = msg['content']
assert content['found']
MinRK
update completion_ and objection_info_request...
r16580 text = content['data']['text/plain']
nt.assert_in(u'123', text)
Thomas Kluyver
Add a test for kernel started without user_ns kwarg....
r12477
# user_module should be an instance of DummyMod
msg_id = client.execute("usermod = get_ipython().user_module")
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
content = msg['content']
nt.assert_equal(content['status'], u'ok')
MinRK
s/object_info_request/inspect_request
r16587 msg_id = client.inspect('usermod')
Thomas Kluyver
Add a test for kernel started without user_ns kwarg....
r12477 msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
content = msg['content']
assert content['found']
MinRK
update completion_ and objection_info_request...
r16580 text = content['data']['text/plain']
nt.assert_in(u'DummyMod', text)
Thomas Kluyver
Add a test for kernel started without user_ns kwarg....
r12477
def test_ipython_start_kernel_no_userns():
# Issue #4188 - user_ns should be passed to shell as None, not {}
cmd = ('from IPython import start_kernel\n'
'start_kernel()')
with setup_kernel(cmd) as client:
# user_module should not be an instance of DummyMod
msg_id = client.execute("usermod = get_ipython().user_module")
msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
content = msg['content']
nt.assert_equal(content['status'], u'ok')
MinRK
s/object_info_request/inspect_request
r16587 msg_id = client.inspect('usermod')
Thomas Kluyver
Add a test for kernel started without user_ns kwarg....
r12477 msg = client.get_shell_msg(block=True, timeout=TIMEOUT)
content = msg['content']
assert content['found']
MinRK
update completion_ and objection_info_request...
r16580 text = content['data']['text/plain']
nt.assert_not_in(u'DummyMod', text)