##// END OF EJS Templates
Merge pull request #4840 from dsblank/master...
Thomas Kluyver -
r14648:8858f7ee merge
parent child Browse files
Show More
@@ -679,7 +679,7 b' class Session(Configurable):'
679 to_send.append(DELIM)
679 to_send.append(DELIM)
680 to_send.append(self.sign(msg_list))
680 to_send.append(self.sign(msg_list))
681 to_send.extend(msg_list)
681 to_send.extend(msg_list)
682 stream.send_multipart(msg_list, flags, copy=copy)
682 stream.send_multipart(to_send, flags, copy=copy)
683
683
684 def recv(self, socket, mode=zmq.NOBLOCK, content=True, copy=True):
684 def recv(self, socket, mode=zmq.NOBLOCK, content=True, copy=True):
685 """Receive and unpack a message.
685 """Receive and unpack a message.
@@ -287,3 +287,27 b' class TestSession(SessionTestCase):'
287 session = ss.Session(packer='msgpack.packb', unpacker='msgpack.unpackb')
287 session = ss.Session(packer='msgpack.packb', unpacker='msgpack.unpackb')
288 self._datetime_test(session)
288 self._datetime_test(session)
289
289
290 def test_send_raw(self):
291 ctx = zmq.Context.instance()
292 A = ctx.socket(zmq.PAIR)
293 B = ctx.socket(zmq.PAIR)
294 A.bind("inproc://test")
295 B.connect("inproc://test")
296
297 msg = self.session.msg('execute', content=dict(a=10))
298 msg_list = [self.session.pack(msg[part]) for part in
299 ['header', 'parent_header', 'metadata', 'content']]
300 self.session.send_raw(A, msg_list, ident=b'foo')
301
302 ident, new_msg_list = self.session.feed_identities(B.recv_multipart())
303 new_msg = self.session.unserialize(new_msg_list)
304 self.assertEqual(ident[0], b'foo')
305 self.assertEqual(new_msg['msg_type'],msg['msg_type'])
306 self.assertEqual(new_msg['header'],msg['header'])
307 self.assertEqual(new_msg['parent_header'],msg['parent_header'])
308 self.assertEqual(new_msg['content'],msg['content'])
309 self.assertEqual(new_msg['metadata'],msg['metadata'])
310
311 A.close()
312 B.close()
313 ctx.term()
General Comments 0
You need to be logged in to leave comments. Login now