From ddba8aeaf0f68976ac3309a697b46791ba365b01 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Tue, 26 Mar 2019 15:44:39 +1000 Subject: [PATCH] qpid: correctly declare support for async event loop qpid transport supports an async interface, but this wasn't declared properly. It was missing an appropriate 'implements' class property. This seems to have been missed because: - kombu 4.x was branched from 3.0.21 - qpid transport was originally added after that in 3.0.24 - Transport.implements was added in commit 6a1abb7e9 on the 4.x branch only, before the qpid transport was in that branch - qpid transport code was then copied between 3.x and 4.x branches but addition of Transport.implements was missed. --- kombu/transport/qpid.py | 6 ++++-- t/unit/transport/test_qpid.py | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/kombu/transport/qpid.py b/kombu/transport/qpid.py index 042d9bc8..524fab04 100644 --- a/kombu/transport/qpid.py +++ b/kombu/transport/qpid.py @@ -119,7 +119,7 @@ except ImportError: # pragma: no cover from kombu.five import Empty, items, monotonic, PY3 from kombu.log import get_logger from kombu.transport.virtual import Base64, Message -from kombu.transport import base +from kombu.transport import base, virtual logger = get_logger(__name__) @@ -1406,7 +1406,9 @@ class Transport(base.Transport): polling_interval = None # This Transport does support the Celery asynchronous event model. - supports_ev = True + implements = virtual.Transport.implements.extend( + asynchronous=True, + ) # The driver type and name for identification purposes. driver_type = 'qpid' diff --git a/t/unit/transport/test_qpid.py b/t/unit/transport/test_qpid.py index f451e190..874ebc60 100644 --- a/t/unit/transport/test_qpid.py +++ b/t/unit/transport/test_qpid.py @@ -1663,9 +1663,6 @@ class test_Transport_class_attributes(object): def test_verify_polling_disabled(self): assert Transport.polling_interval is None - def test_transport_verify_supports_asynchronous_events(self): - assert Transport.supports_ev - def test_verify_driver_type_and_name(self): assert Transport.driver_type == 'qpid' assert Transport.driver_name == 'qpid' @@ -1819,6 +1816,10 @@ class test_Transport(object): """Creates a mock_client to be used in testing.""" self.mock_client = Mock() + def test_supports_ev(self): + """Test that the transport claims to support async event loop""" + assert Transport(self.mock_client).supports_ev + def test_close_connection(self): """Test that close_connection calls close on the connection.""" my_transport = Transport(self.mock_client)