Permalink
Browse files

Add a test for version_request in test_message_spec.py

  • Loading branch information...
1 parent 7c4fc04 commit 8d48684f2fedf10130e7cb7af265f8c6c539a758 @tkf committed Dec 4, 2012
Showing with 26 additions and 0 deletions.
  1. +6 −0 IPython/zmq/kernelmanager.py
  2. +20 −0 IPython/zmq/tests/test_message_spec.py
@@ -363,6 +363,12 @@ def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
self._queue_send(msg)
return msg['header']['msg_id']
+ def version(self):
+ """Request kernel version info."""
+ msg = self.session.msg('version_request')
+ self._queue_send(msg)
+ return msg['header']['msg_id']
+
def shutdown(self, restart=False):
"""Request an immediate kernel shutdown.
@@ -16,6 +16,7 @@
import nose.tools as nt
from ..blockingkernelmanager import BlockingKernelManager
+from .. import ipkernel
from IPython.testing import decorators as dec
@@ -195,6 +196,12 @@ class CompleteReply(Reference):
matches = List(Unicode)
+class VersionReply(Reference):
+ version = Enum((ipkernel.version))
+ version_major = Enum((ipkernel.version_major,))
+ version_minor = Enum((ipkernel.version_minor,))
+
+
# IOPub messages
class PyIn(Reference):
@@ -236,6 +243,7 @@ def _data_changed(self, name, old, new):
'object_info_reply' : OInfoReply(),
'status' : Status(),
'complete_reply' : CompleteReply(),
+ 'version_reply': VersionReply(),
'pyin' : PyIn(),
'pyout' : PyOut(),
'pyerr' : PyErr(),
@@ -434,6 +442,18 @@ def test_complete():
yield nt.assert_true(name in matches, "Missing match: %r" % name)
+@dec.parametric
+def test_version_request():
+ flush_channels()
+
+ shell = KM.shell_channel
+
+ msg_id = shell.version()
+ reply = shell.get_msg(timeout=2)
+ for tst in validate_message(reply, 'version_reply', msg_id):
+ yield tst
+
+
# IOPub channel

0 comments on commit 8d48684

Please sign in to comment.