From a5d15d6aad7af12a5a8e6334ef49f67a13690ce2 2012-04-28 17:22:32 From: MinRK Date: 2012-04-28 17:22:32 Subject: [PATCH] handle pyout messages in test_message_spec and wait for kernel to start, so side effects of startup do not pollute the first test. --- diff --git a/IPython/zmq/tests/test_message_spec.py b/IPython/zmq/tests/test_message_spec.py index c97d1c3..4c85650 100644 --- a/IPython/zmq/tests/test_message_spec.py +++ b/IPython/zmq/tests/test_message_spec.py @@ -34,6 +34,11 @@ def setup(): KM.start_kernel(stdout=PIPE, stderr=PIPE) KM.start_channels() + + # wait for kernel to be ready + KM.shell_channel.execute("pass") + KM.shell_channel.get_msg(block=True, timeout=5) + flush_channels() def teardown(): @@ -207,12 +212,22 @@ class DisplayData(Reference): nt.assert_true(isinstance(v, basestring), "expected string data, got %r" % v) +class PyOut(Reference): + execution_count = Integer() + data = Dict() + def _data_changed(self, name, old, new): + for k,v in new.iteritems(): + nt.assert_true(mime_pat.match(k)) + nt.assert_true(isinstance(v, basestring), "expected string data, got %r" % v) + + references = { 'execute_reply' : ExecuteReply(), 'object_info_reply' : OInfoReply(), 'status' : Status(), 'complete_reply' : CompleteReply(), 'pyin' : PyIn(), + 'pyout' : PyOut(), 'pyerr' : PyErr(), 'stream' : Stream(), 'display_data' : DisplayData(),