Example #1
0
    def test_1_msg_invalid_unicode_in_packet_ignored_logged(self):
        url = Inproc.pick()
        debugp('using url %s' % url)
        ctx = zmq.Context(1)
        sock = ctx.socket(zmq.PUB)
        sock.bind(url)

        time.sleep(0.2)

        sub = zmqsub.ConnectSub(url, context=ctx)

        time.sleep(1.0)

        sock.send(b'\xe2')

        self.assertRaises(zmqsub.NoMessagesException, sub.recv, timeout=0.5)
Example #2
0
    def test_1_msg_invalid_unicode_in_packet_ignored_logged(self):
        url = Inproc.pick()
        debugp('using url %s' % url)
        ctx = zmq.Context(1)
        sock = ctx.socket(zmq.PUB)
        sock.bind(url)

        time.sleep(0.2)

        sub = zmqsub.ConnectSub(url, context=ctx)

        time.sleep(1.0)

        sock.send(b'\xe2')

        self.assertRaises(zmqsub.NoMessagesException, sub.recv, timeout=0.5)
Example #3
0
 def test_1_msg_bindpub(self):
     url, pub = cchooser(zmqsub.BindPub)
     debugp('using url %s' % url)
     sub = zmqsub.ConnectSub(url, context=pub)
     pub.send({u'您好': u'World'})
     self.assertEquals({u'您好': u'World'}, sub.recv(timeout=2.0))
Example #4
0
 def test_1_msg_connectpub(self):
     raise nose.exc.SkipTest("I have no idea why this test doesn't pass. It really should. It does not. Sadness.")
     url, sub = cchooser(zmqsub.BindSub)
     debugp('using url %s' % url)
     debugp("bound for sub")
     pub = zmqsub.ConnectPub(url, context=sub)
     debugp("connected, selecting for write")
     r, w, x = zmqsub.select([], [pub], [], 1.0)
     debugp("selected for write, checking")
     self.assertEquals(1, len(w))
     debugp("write ready, writing")
     pub.send({u'您好': u'World'})
     time.sleep(2.0)
     debugp("selecting for read..")
     r, w, x = zmqsub.select([sub], [], [], 1.0)
     debugp("selected for read")
     self.assertEquals(1, len(r))
     debugp("read ready, reading")
     self.assertEquals({u'您好': u'World'}, sub.recv(timeout=3.0))
     debugp("the value made it through fine.")
Example #5
0
 def test_1_msg_bindpub(self):
     url, pub = cchooser(zmqsub.BindPub)
     debugp('using url %s' % url)
     sub = zmqsub.ConnectSub(url, context=pub)
     pub.send({u'您好': u'World'})
     self.assertEquals({u'您好': u'World'}, sub.recv(timeout=2.0))
Example #6
0
 def test_1_msg_connectpub(self):
     raise nose.exc.SkipTest(
         "I have no idea why this test doesn't pass. It really should. It does not. Sadness."
     )
     url, sub = cchooser(zmqsub.BindSub)
     debugp('using url %s' % url)
     debugp("bound for sub")
     pub = zmqsub.ConnectPub(url, context=sub)
     debugp("connected, selecting for write")
     r, w, x = zmqsub.select([], [pub], [], 1.0)
     debugp("selected for write, checking")
     self.assertEquals(1, len(w))
     debugp("write ready, writing")
     pub.send({u'您好': u'World'})
     time.sleep(2.0)
     debugp("selecting for read..")
     r, w, x = zmqsub.select([sub], [], [], 1.0)
     debugp("selected for read")
     self.assertEquals(1, len(r))
     debugp("read ready, reading")
     self.assertEquals({u'您好': u'World'}, sub.recv(timeout=3.0))
     debugp("the value made it through fine.")