diff --git a/test/amqp_test.py b/test/amqp_test.py index d220607640f09263623392a87f92f1c37d24d3e4..955629a5b445e433d11d823cef10c578ad68bd9b 100644 --- a/test/amqp_test.py +++ b/test/amqp_test.py @@ -1,14 +1,21 @@ +"""Tests for ``pulsar.client.amqp_exchange``.""" import time import threading -from .test_utils import skip_unless_module from pulsar.client import amqp_exchange +from .test_utils import ( + skip_unless_module, + timed, +) + TEST_CONNECTION = "memory://test_amqp" @skip_unless_module("kombu") +@timed(15) def test_amqp(): + """Test the client PulsarExchange abstraction with an in-memory connection.""" manager1_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager_test") manager3_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager3_test") manager2_exchange = amqp_exchange.PulsarExchange(TEST_CONNECTION, "manager2_test") @@ -56,3 +63,6 @@ class TestThread(threading.Thread): raise AssertionError(msg) self.join(2) + + +__all__ = ["test_amqp"] diff --git a/test/client_transport_test.py b/test/client_transport_test.py index c3a2cb6d1abf29c9e232d602418bfc0d386fe230..9c76042f04caef7f1eac38fb883961d542e19c2f 100644 --- a/test/client_transport_test.py +++ b/test/client_transport_test.py @@ -1,18 +1,21 @@ import os +from tempfile import NamedTemporaryFile from pulsar.client.transport.standard import Urllib2Transport from pulsar.client.transport.curl import PycurlTransport from pulsar.client.transport.curl import post_file from pulsar.client.transport.curl import get_file from pulsar.client.transport import get_transport -from tempfile import NamedTemporaryFile + from .test_utils import files_server +from .test_utils import skip_unless_module def test_urllib_transports(): _test_transport(Urllib2Transport()) +@skip_unless_module("pycurl") def test_pycurl_transport(): _test_transport(PycurlTransport()) @@ -37,6 +40,7 @@ def _test_transport(transport): assert open(output_path, 'r').read().find("Test123") >= 0 +@skip_unless_module("pycurl") def test_curl_put_get(): with files_server() as (server, directory): server_url = server.application_url @@ -74,6 +78,7 @@ def test_curl_status_code(): assert exception_raised +@skip_unless_module("pycurl") def test_curl_problems(): with files_server() as (server, directory): server_url = server.application_url