PyZmq Tornado Event Loop

pyzmq是ZeroMQ消息库的Python包装器。

Facebook的Tornado包括一个eventloop,用于在文件描述符和本机套接字上处理轮询事件。pyzmq已经包含了Tornado的一小部分(特别是它的ioloop),并将其IOStream类适配到ZMQStream中,以处理ØMQ套接字上的轮询事件。ZMQStream对象的工作方式与套接字对象非常相似,但不是直接调用recv(),而是使用on_recv()注册回调。回调函数也可以通过on_send()来注册send事件。

下面是一个带有zeroMQ PUB子套接字的Tornado HTTP服务器示例:

#!/usr/bin/env python
import json
import tornado
import tornado.web
import zmq
from tornado import httpserver
from zmq.eventloop import ioloop
from zmq.eventloop.zmqstream import ZMQStream

ioloop.install()
tornado.ioloop = ioloop
import sys


def ping_remote():
    """callback to keep the connection with remote server alive while we wait
    Network routers between raspberry pie and cloud server will close the socket
    if there is no data exchanged for long time.
    """
    pub_inst.send_json_data(msg="Ping", req_id="##")
    sys.stdout.write('.')
    sys.stdout.flush()


pending_requests = {}


class ZMQSub(object):
    def __init__(self, callback):
        self.callback = callback
        context = zmq.Context()
        socket = context.socket(zmq.SUB)
        # socket.connect('tcp://127.0.0.1:5559')
        socket.bind('tcp://*:8081')
        self.stream = ZMQStream(socket)
        self.stream.on_recv(self.callback)
        socket.setsockopt(zmq.SUBSCRIBE, "")

    def shutdown_zmq_sub(self):
        self.stream.close()


class ZMQPub(object):
    def __init__(self):
        context = zmq.Context()
        socket = context.socket(zmq.PUB)
        socket.bind('tcp://*:8082')
        self.publish_stream = ZMQStream(socket)

    def send_json_data(self, msg, req_id):
        topic = str(req_id)
        self.publish_stream.send_multipart([topic, msg])

    def shutdown_zmq_sub(self):
        self.publish_stream.close()


def SensorCb(msg):
    # decode message from raspberry pie and the channel ID.
    key, msg = (i for i in msg)
    if not key == "##":
        msg = json.loads(msg)

        if key in pending_requests.keys():
            req_inst = pending_requests[key]
            req_inst.write(msg)
            req_inst.finish()
            del pending_requests[key]
        else:
            print "no such request"
            print pending_requests
    else:
        print "received ping"


class Handler(tornado.web.RequestHandler):
    def __init__(self, *args, **kwargs):
        super(Handler, self).__init__(*args, **kwargs)

        # get the unique req id
        self.req_id = str(self.application.req_id) + "#"
        self.application.req_id += 1

        # set headers
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "x-requested-with")
        self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT')

    @tornado.web.asynchronous
    def get(self):
        print self.request
        if self.req_id not in pending_requests.keys():
            pending_requests[self.req_id] = self
        else:
            print "WTF"
        pub_inst.send_json_data(msg=json.dumps({"op": "ServiceCall"}), req_id=self.req_id)


if __name__ == "__main__":
    pub_inst = ZMQPub()
    sub_inst = ZMQSub(callback=SensorCb)
    application = tornado.web.Application(
        [(r'/get_sensor_data', Handler), (r'/(.*)')])
    application.req_id = 0
    server = httpserver.HTTPServer(application, )
    port = 8080
    server.listen(port)
    print "Sensor server ready on port: ", port
    ping = ioloop.PeriodicCallback(ping_remote, 3000)
    ping.start()
    tornado.ioloop.IOLoop.instance().start()

 

 

 

 

 

参考:https://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/multisocket/tornadoeventloop.html

https://stackoverflow.com/questions/27054723/how-do-i-run-pyzmq-and-a-webserver-in-one-ioloop

 

搞了一个公众号PostgreSQL运维技术,欢迎来踩~,刚搞起,有很多不足,多多包涵~

悄悄放一张:

 

已标记关键词 清除标记
相关推荐
<div><p>When packaging pyzmq for OpenSUSE we run into these failing tests:</p> <pre><code> [ 22s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-pyzmq-19.0.2-0.x86_64/usr/lib64/python3.8/site-packages [ 22s] + PYTHONDONTWRITEBYTECODE=1 [ 22s] + pytest-3.8 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v [ 23s] ============================= test session starts ============================== [ 23s] platform linux -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3 [ 23s] cachedir: .pytest_cache [ 23s] rootdir: /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2 [ 23s] collecting ... collected 330 items ... [ 66s] =================================== FAILURES =================================== [ 66s] _________________________ TestFrame.test_buffer_numpy __________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_buffer_numpy"> [ 66s] [ 66s] [ 66s] def test_buffer_numpy(self): [ 66s] """test non-copying numpy array messages""" [ 66s] try: [ 66s] import numpy [ 66s] from numpy.testing import assert_array_equal [ 66s] except ImportError: [ 66s] raise SkipTest("requires numpy") [ 66s] if sys.version_info < (2,7): [ 66s] raise SkipTest("requires new-style buffer interface (py >= 2.7)") [ 66s] rand = numpy.random.randint [ 66s] shapes = [ rand(2,5) for i in range(5) ] [ 66s] a,b = self.create_bound_pair(zmq.PAIR, zmq.PAIR) [ 66s] dtypes = [int, float, '>i4', 'B'] [ 66s] for i in range(1,len(shapes)+1): [ 66s] shape = shapes[:i] [ 66s] for dt in dtypes: [ 66s] A = numpy.empty(shape, dtype=dt) [ 66s] a.send(A, copy=False) [ 66s] msg = b.recv(copy=False) [ 66s] [ 66s] > B = numpy.frombuffer(msg, A.dtype).reshape(A.shape) [ 66s] E TypeError: a bytes-like object is required, not 'Frame' [ 66s] [ 66s] zmq/tests/test_message.py:321: TypeError [ 66s] _____________________________ TestFrame.test_bytes _____________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_bytes"> [ 66s] [ 66s] def test_bytes(self): [ 66s] """Test the Frame.bytes property.""" [ 66s] for i in range(1,16): [ 66s] s = (2**i)*x [ 66s] m = zmq.Frame(s) [ 66s] b = m.bytes [ 66s] self.assertEqual(s, m.bytes) [ 66s] if not PYPY: [ 66s] # check that it copies [ 66s] > self.assert_(b is not s) [ 66s] E AssertionError: False is not true [ 66s] [ 66s] zmq/tests/test_message.py:76: AssertionError [ 66s] __________________________ TestFrame.test_frame_more ___________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_frame_more"> [ 66s] [ 66s] def test_frame_more(self): [ 66s] """test Frame.more attribute""" [ 66s] frame = zmq.Frame(b"hello") [ 66s] self.assertFalse(frame.more) [ 66s] sa,sb = self.create_bound_pair(zmq.PAIR, zmq.PAIR) [ 66s] sa.send_multipart([b'hi', b'there']) [ 66s] frame = self.recv(sb, copy=False) [ 66s] self.assertTrue(frame.more) [ 66s] if zmq.zmq_version_info()[0] >= 3 and not PYPY: [ 66s] > self.assertTrue(frame.get(zmq.MORE)) [ 66s] E AttributeError: 'Frame' object has no attribute 'get' [ 66s] [ 66s] zmq/tests/test_message.py:343: AttributeError [ 66s] __________________________ TestFrame.test_lifecycle1 ___________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_lifecycle1"> [ 66s] [ 66s] [ 66s] def test_lifecycle1(self): [ 66s] """Run through a ref counting cycle with a copy.""" [ 66s] for i in range(5, 16): # 32, 64,..., 65536 [ 66s] s = (2**i)*x [ 66s] rc = 2 [ 66s] self.assertEqual(grc(s), rc) [ 66s] m = zmq.Frame(s, copy=False) [ 66s] rc += 2 [ 66s] self.assertEqual(grc(s), rc) [ 66s] m2 = copy.copy(m) [ 66s] rc += 1 [ 66s] self.assertEqual(grc(s), rc) [ 66s] buf = m2.buffer [ 66s] [ 66s] rc += view_rc [ 66s] > self.assertEqual(grc(s), rc) [ 66s] E AssertionError: 5 != 6 [ 66s] [ 66s] zmq/tests/test_message.py:112: AssertionError [ 66s] __________________________ TestFrame.test_lifecycle2 ___________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_lifecycle2"> [ 66s] [ 66s] [ 66s] def test_lifecycle2(self): [ 66s] """Run through a different ref counting cycle with a copy.""" [ 66s] for i in range(5, 16): # 32, 64,..., 65536 [ 66s] s = (2**i)*x [ 66s] rc = 2 [ 66s] self.assertEqual(grc(s), rc) [ 66s] m = zmq.Frame(s, copy=False) [ 66s] rc += 2 [ 66s] self.assertEqual(grc(s), rc) [ 66s] m2 = copy.copy(m) [ 66s] rc += 1 [ 66s] self.assertEqual(grc(s), rc) [ 66s] buf = m.buffer [ 66s] rc += view_rc [ 66s] > self.assertEqual(grc(s), rc) [ 66s] E AssertionError: 5 != 6 [ 66s] [ 66s] zmq/tests/test_message.py:147: AssertionError [ 66s] _______________________ TestFrame.test_memoryview_shape ________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_memoryview_shape"> [ 66s] [ 66s] [ 66s] def test_memoryview_shape(self): [ 66s] """memoryview shape info""" [ 66s] if sys.version_info < (3,): [ 66s] raise SkipTest("only test memoryviews on Python 3") [ 66s] data = b("§§¶•ªº˜µ¬˚…∆˙åß∂©œ∑´†≈ç√") [ 66s] n = len(data) [ 66s] f = zmq.Frame(data) [ 66s] view1 = f.buffer [ 66s] self.assertEqual(view1.ndim, 1) [ 66s] self.assertEqual(view1.shape, (n,)) [ 66s] self.assertEqual(view1.tobytes(), data) [ 66s] > view2 = memoryview(f) [ 66s] E TypeError: memoryview: a bytes-like object is required, not 'Frame' [ 66s] [ 66s] zmq/tests/test_message.py:236: TypeError [ 66s] _________________________ TestFrame.test_multi_tracker _________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_multi_tracker"> [ 66s] [ 66s] [ 66s] def test_multi_tracker(self): [ 66s] m = zmq.Frame(b'asdf', copy=False, track=True) [ 66s] m2 = zmq.Frame(b'whoda', copy=False, track=True) [ 66s] mt = zmq.MessageTracker(m,m2) [ 66s] > self.assertFalse(m.tracker.done) [ 66s] E AssertionError: True is not false [ 66s] [ 66s] zmq/tests/test_message.py:193: AssertionError [ 66s] ____________________________ TestFrame.test_tracker ____________________________ [ 66s] [ 66s] self = <zmq.tests.test_message.testframe testmethod="test_tracker"> [ 66s] [ 66s] [ 66s] def test_tracker(self): [ 66s] m = zmq.Frame(b'asdf', copy=False, track=True) [ 66s] > self.assertFalse(m.tracker.done) [ 66s] E AssertionError: True is not false [ 66s] [ 66s] zmq/tests/test_message.py:171: AssertionError [ 66s] ___________________________ TestSecurity.test_curve ____________________________ [ 66s] [ 66s] self = <zmq.tests.test_security.testsecurity testmethod="test_curve"> [ 66s] [ 66s] def test_curve(self): [ 66s] """test CURVE encryption""" [ 66s] server = self.socket(zmq.DEALER) [ 66s] server.identity = b'IDENT' [ 66s] client = self.socket(zmq.DEALER) [ 66s] self.sockets.extend([server, client]) [ 66s] try: [ 66s] server.curve_server = True [ 66s] except zmq.ZMQError as e: [ 66s] # will raise EINVAL if no CURVE support [ 66s] if e.errno == zmq.EINVAL: [ 66s] raise SkipTest("CURVE unsupported") [ 66s] [ 66s] server_public, server_secret = zmq.curve_keypair() [ 66s] client_public, client_secret = zmq.curve_keypair() [ 66s] [ 66s] server.curve_secretkey = server_secret [ 66s] server.curve_publickey = server_public [ 66s] client.curve_serverkey = server_public [ 66s] client.curve_publickey = client_public [ 66s] client.curve_secretkey = client_secret [ 66s] [ 66s] self.assertEqual(server.mechanism, zmq.CURVE) [ 66s] self.assertEqual(client.mechanism, zmq.CURVE) [ 66s] [ 66s] self.assertEqual(server.get(zmq.CURVE_SERVER), True) [ 66s] self.assertEqual(client.get(zmq.CURVE_SERVER), False) [ 66s] [ 66s] with self.zap(): [ 66s] iface = 'tcp://127.0.0.1' [ 66s] port = server.bind_to_random_port(iface) [ 66s] client.connect("%s:%i" % (iface, port)) [ 66s] > self.bounce(server, client) [ 66s] [ 66s] zmq/tests/test_security.py:236: [ 66s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [ 66s] [ 66s] self = <zmq.tests.test_security.testsecurity testmethod="test_curve"> [ 66s] server = <zmq.sugar.socket.socket object at> [ 66s] client = <zmq.sugar.socket.socket object at> [ 66s] test_metadata = True [ 66s] [ 66s] def bounce(self, server, client, test_metadata=True): [ 66s] msg = [os.urandom(64), os.urandom(64)] [ 66s] client.send_multipart(msg) [ 66s] frames = self.recv_multipart(server, copy=False) [ 66s] recvd = list(map(lambda x: x.bytes, frames)) [ 66s] [ 66s] try: [ 66s] if test_metadata and not PYPY: [ 66s] for frame in frames: [ 66s] > self.assertEqual(frame.get('User-Id'), 'anonymous') [ 66s] E AttributeError: 'Frame' object has no attribute 'get' [ 66s] [ 66s] zmq/tests/test_security.py:93: AttributeError [ 66s] ___________________________ TestSecurity.test_plain ____________________________ [ 66s] [ 66s] self = <zmq.tests.test_security.testsecurity testmethod="test_plain"> [ 66s] [ 66s] def test_plain(self): [ 66s] """test PLAIN authentication""" [ 66s] server = self.socket(zmq.DEALER) [ 66s] server.identity = b'IDENT' [ 66s] client = self.socket(zmq.DEALER) [ 66s] self.assertEqual(client.plain_username, b'') [ 66s] self.assertEqual(client.plain_password, b'') [ 66s] client.plain_username = USER [ 66s] client.plain_password = PASS [ 66s] self.assertEqual(client.getsockopt(zmq.PLAIN_USERNAME), USER) [ 66s] self.assertEqual(client.getsockopt(zmq.PLAIN_PASSWORD), PASS) [ 66s] self.assertEqual(client.plain_server, 0) [ 66s] self.assertEqual(server.plain_server, 0) [ 66s] server.plain_server = True [ 66s] self.assertEqual(server.mechanism, zmq.PLAIN) [ 66s] self.assertEqual(client.mechanism, zmq.PLAIN) [ 66s] [ 66s] assert not client.plain_server [ 66s] assert server.plain_server [ 66s] [ 66s] with self.zap(): [ 66s] iface = 'tcp://127.0.0.1' [ 66s] port = server.bind_to_random_port(iface) [ 66s] client.connect("%s:%i" % (iface, port)) [ 66s] > self.bounce(server, client) [ 66s] [ 66s] zmq/tests/test_security.py:141: [ 66s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [ 66s] [ 66s] self = <zmq.tests.test_security.testsecurity testmethod="test_plain"> [ 66s] server = <zmq.sugar.socket.socket object at> [ 66s] client = <zmq.sugar.socket.socket object at> [ 66s] test_metadata = True [ 66s] [ 66s] def bounce(self, server, client, test_metadata=True): [ 66s] msg = [os.urandom(64), os.urandom(64)] [ 66s] client.send_multipart(msg) [ 66s] frames = self.recv_multipart(server, copy=False) [ 66s] recvd = list(map(lambda x: x.bytes, frames)) [ 66s] [ 66s] try: [ 66s] if test_metadata and not PYPY: [ 66s] for frame in frames: [ 66s] > self.assertEqual(frame.get('User-Id'), 'anonymous') [ 66s] E AttributeError: 'Frame' object has no attribute 'get' [ 66s] [ 66s] zmq/tests/test_security.py:93: AttributeError [ 66s] __________________________ TestSocket.test_large_send __________________________ [ 66s] [ 66s] self = <zmq.tests.test_socket.testsocket testmethod="test_large_send"> [ 66s] [ 66s] .skipif( [ 66s] ( [ 66s] pypy and on_travis [ 66s] ) or ( [ 66s] sys.maxsize < 2**32 [ 66s] ) or ( [ 66s] windows [ 66s] ), [ 66s] reason="only run on 64b and not on Travis." [ 66s] ) [ 66s] .large [ 66s] def test_large_send(self): [ 66s] c = os.urandom(1) [ 66s] N = 2**31 + 1 [ 66s] try: [ 66s] buf = c * N [ 66s] except MemoryError as e: [ 66s] raise SkipTest("Not enough memory: %s" % e) [ 66s] a, b = self.create_bound_pair() [ 66s] try: [ 66s] a.send(buf, copy=False) [ 66s] rcvd = b.recv(copy=False) [ 66s] except MemoryError as e: [ 66s] raise SkipTest("Not enough memory: %s" % e) [ 66s] # sample the front and back of the received message [ 66s] # without checking the whole content [ 66s] # Python 2: items in memoryview are bytes [ 66s] # Python 3: items im memoryview are int [ 66s] byte = c if sys.version_info < (3,) else ord(c) [ 66s] > view = memoryview(rcvd) [ 66s] E TypeError: memoryview: a bytes-like object is required, not 'Frame' [ 66s] [ 66s] zmq/tests/test_socket.py:545: TypeError [ 66s] _______________________ TestSocketGreen.test_large_send ________________________ [ 66s] [ 66s] self = <zmq.tests.test_socket.testsocketgreen testmethod="test_large_send"> [ 66s] [ 66s] .skipif( [ 66s] ( [ 66s] pypy and on_travis [ 66s] ) or ( [ 66s] sys.maxsize < 2**32 [ 66s] ) or ( [ 66s] windows [ 66s] ), [ 66s] reason="only run on 64b and not on Travis." [ 66s] ) [ 66s] .large [ 66s] def test_large_send(self): [ 66s] c = os.urandom(1) [ 66s] N = 2**31 + 1 [ 66s] try: [ 66s] buf = c * N [ 66s] except MemoryError as e: [ 66s] raise SkipTest("Not enough memory: %s" % e) [ 66s] a, b = self.create_bound_pair() [ 66s] try: [ 66s] a.send(buf, copy=False) [ 66s] rcvd = b.recv(copy=False) [ 66s] except MemoryError as e: [ 66s] raise SkipTest("Not enough memory: %s" % e) [ 66s] # sample the front and back of the received message [ 66s] # without checking the whole content [ 66s] # Python 2: items in memoryview are bytes [ 66s] # Python 3: items im memoryview are int [ 66s] byte = c if sys.version_info < (3,) else ord(c) [ 66s] > view = memoryview(rcvd) [ 66s] E TypeError: memoryview: a bytes-like object is required, not 'Frame' [ 66s] [ 66s] zmq/tests/test_socket.py:545: TypeError [ 66s] =============================== warnings summary =============================== [ 66s] ../../../../../usr/lib64/python3.8/site-packages/cffi/vengine_cpy.py:4 [ 66s] /usr/lib64/python3.8/site-packages/cffi/vengine_cpy.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses [ 66s] import sys, imp [ 66s] [ 66s] zmq/tests/test_future.py:125 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_future.py:125: PytestUnknownMarkWarning: Unknown pytest.mark.now - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html [ 66s] .mark.now [ 66s] [ 66s] zmq/tests/test_future.py:134 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_future.py:134: PytestUnknownMarkWarning: Unknown pytest.mark.now - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html [ 66s] .mark.now [ 66s] [ 66s] zmq/tests/test_socket.py:526 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_socket.py:526: PytestUnknownMarkWarning: Unknown pytest.mark.large - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html [ 66s] .large [ 66s] [ 66s] zmq/tests/test_win32_shim.py:25 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_win32_shim.py:25: PytestUnknownMarkWarning: Unknown pytest.mark.new_console - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html [ 66s] .new_console [ 66s] [ 66s] zmq/tests/test_win32_shim.py:28 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_win32_shim.py:28: PytestUnknownMarkWarning: Unknown pytest.mark.new_console - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html [ 66s] .new_console [ 66s] [ 66s] zmq/auth/asyncio/__init__.py:26 [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/auth/asyncio/__init__.py:26: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def __handle_zap(self): [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_context_manager [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:72: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(c.closed) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_copy [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:315: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(c2._shadow) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_copy [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:316: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(c3._shadow) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_init [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:43: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(isinstance(c1, self.Context)) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_init [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:46: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(isinstance(c2, self.Context)) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_init [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:49: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(isinstance(c3, self.Context)) [ 66s] [ 66s] zmq/tests/test_context.py::TestContext::test_term [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_context.py:67: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(c.closed) [ 66s] [ 66s] zmq/tests/test_ioloop.py::TestIOLoop::test_close_all [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_ioloop.py:110: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops. [ 66s] loop = self.IOLoop.current() [ 66s] [ 66s] zmq/tests/test_message.py::TestFrame::test_buffer_out [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_message.py:221: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(outb is m.buffer) [ 66s] [ 66s] zmq/tests/test_message.py::TestFrame::test_buffer_out [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_message.py:222: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(m.buffer is m.buffer) [ 66s] [ 66s] zmq/tests/test_message.py::TestFrame::test_bytes [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_message.py:76: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(b is not s) [ 66s] [ 66s] zmq/tests/test_poll.py::TestSelect::test_pair [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_poll.py:190: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(s1 in wlist) [ 66s] [ 66s] zmq/tests/test_poll.py::TestSelect::test_pair [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_poll.py:191: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(s2 in wlist) [ 66s] [ 66s] zmq/tests/test_poll.py::TestSelect::test_pair [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_poll.py:192: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(s1 not in rlist) [ 66s] [ 66s] zmq/tests/test_poll.py::TestSelect::test_pair [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_poll.py:193: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(s2 not in rlist) [ 66s] [ 66s] zmq/tests/test_socket.py::TestSocket::test_copy [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_copy [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_socket.py:447: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(scopy._shadow) [ 66s] [ 66s] zmq/tests/test_socket.py::TestSocket::test_copy [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_copy [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/test_socket.py:448: DeprecationWarning: Please use assertTrue instead. [ 66s] self.assert_(sdcopy._shadow) [ 66s] [ 66s] zmq/tests/test_socket.py::TestSocket::test_int_sockopts [ 66s] zmq/tests/test_socket.py::TestSocket::test_int_sockopts [ 66s] zmq/tests/test_socket.py::TestSocket::test_mockable [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_int_sockopts [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_int_sockopts [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_mockable [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/sugar/socket.py:129: DeprecationWarning: Socket.socket_type is deprecated, use Socket.type [ 66s] warnings.warn("Socket.socket_type is deprecated, use Socket.type", [ 66s] [ 66s] zmq/tests/test_socket.py::TestSocketGreen::test_mockable [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/green/core.py:269: UserWarning: TIMEO socket options have no effect in zmq.green [ 66s] warnings.warn("TIMEO socket options have no effect in zmq.green", UserWarning) [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_custom_serialize [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:234: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_custom_serialize_error [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:256: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_poll [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:306: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_poll_base_socket [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:329: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_poll_on_closed_socket [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:352: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_poll_raw [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:373: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:105: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_cancel [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:290: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_dontwait [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:275: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_json [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:161: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_json_cancelled [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:175: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_multipart [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:94: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_pyobj [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:204: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_string [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:147: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_recv_timeout [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:121: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_send_timeout [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:138: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] zmq/tests/asyncio/test_asyncio.py::TestAsyncIOSocket::test_shadow [ 66s] /home/abuild/rpmbuild/BUILD/pyzmq-19.0.2/zmq/tests/asyncio/_test_asyncio.py:406: DeprecationWarning: "" decorator is deprecated since Python 3.8, use "async def" instead [ 66s] def test(): [ 66s] [ 66s] -- Docs: https://docs.pytest.org/en/stable/warnings.html [ 66s] =========================== short test summary info ============================ [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_buffer_numpy - TypeError: a... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_bytes - AssertionError: Fal... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_frame_more - AttributeError... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_lifecycle1 - AssertionError... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_lifecycle2 - AssertionError... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_memoryview_shape - TypeErro... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_multi_tracker - AssertionEr... [ 66s] FAILED zmq/tests/test_message.py::TestFrame::test_tracker - AssertionError: T... [ 66s] FAILED zmq/tests/test_security.py::TestSecurity::test_curve - AttributeError:... [ 66s] FAILED zmq/tests/test_security.py::TestSecurity::test_plain - AttributeError:... [ 66s] FAILED zmq/tests/test_socket.py::TestSocket::test_large_send - TypeError: mem... [ 66s] FAILED zmq/tests/test_socket.py::TestSocketGreen::test_large_send - TypeError... [ 66s] =========== 12 failed, 301 passed, 17 skipped, 50 warnings in 43.47s =========== </zmq.tests.test_socket.testsocketgreen></zmq.tests.test_socket.testsocket></zmq.sugar.socket.socket></zmq.sugar.socket.socket></zmq.tests.test_security.testsecurity></zmq.tests.test_security.testsecurity></zmq.sugar.socket.socket></zmq.sugar.socket.socket></zmq.tests.test_security.testsecurity></zmq.tests.test_security.testsecurity></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></zmq.tests.test_message.testframe></code></pre> <p><a href="https://github.com/zeromq/pyzmq/files/5377986/_log.txt">Full log with all details</a></p><p>该提问来源于开源项目:zeromq/pyzmq</p></div>
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页