Use import of zmq package for test skip
Using the import of impl_zmq to decide whether to skip tests is unsafe as if something breaks in the import, then the tests are skipped, potentially hiding a bug. Switch to using the import of the zmq package itself to decide whether tests should be executed or not; this should cover the currently unsupported Python3 test coverage. Change-Id: I7d65506845b039f5e2be4c460bede977122deca9
This commit is contained in:
		| @@ -21,6 +21,11 @@ import mock | |||||||
| from oslo_utils import importutils | from oslo_utils import importutils | ||||||
| import testtools | import testtools | ||||||
|  |  | ||||||
|  | try: | ||||||
|  |     import zmq | ||||||
|  | except ImportError: | ||||||
|  |     zmq = None | ||||||
|  |  | ||||||
| import oslo_messaging | import oslo_messaging | ||||||
| from oslo_messaging.tests import utils as test_utils | from oslo_messaging.tests import utils as test_utils | ||||||
|  |  | ||||||
| @@ -45,7 +50,7 @@ def get_unused_port(): | |||||||
| class ZmqBaseTestCase(test_utils.BaseTestCase): | class ZmqBaseTestCase(test_utils.BaseTestCase): | ||||||
|     """Base test case for all ZMQ tests that make use of the ZMQ Proxy""" |     """Base test case for all ZMQ tests that make use of the ZMQ Proxy""" | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(ZmqBaseTestCase, self).setUp() |         super(ZmqBaseTestCase, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -73,7 +78,7 @@ class ZmqBaseTestCase(test_utils.BaseTestCase): | |||||||
|  |  | ||||||
| class TestConfZmqDriverLoad(test_utils.BaseTestCase): | class TestConfZmqDriverLoad(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestConfZmqDriverLoad, self).setUp() |         super(TestConfZmqDriverLoad, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -173,7 +178,7 @@ class TestZmqBasics(ZmqBaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqSocket(test_utils.BaseTestCase): | class TestZmqSocket(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestZmqSocket, self).setUp() |         super(TestZmqSocket, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -260,7 +265,7 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqIncomingMessage(test_utils.BaseTestCase): | class TestZmqIncomingMessage(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestZmqIncomingMessage, self).setUp() |         super(TestZmqIncomingMessage, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
|   | |||||||
| @@ -20,6 +20,11 @@ import fixtures | |||||||
| import mock | import mock | ||||||
| import testtools | import testtools | ||||||
|  |  | ||||||
|  | try: | ||||||
|  |     import zmq | ||||||
|  | except ImportError: | ||||||
|  |     zmq = None | ||||||
|  |  | ||||||
| from oslo import messaging | from oslo import messaging | ||||||
| from oslo.utils import importutils | from oslo.utils import importutils | ||||||
| from oslo_messaging.tests import utils as test_utils | from oslo_messaging.tests import utils as test_utils | ||||||
| @@ -27,7 +32,7 @@ from oslo_messaging.tests import utils as test_utils | |||||||
| # eventlet is not yet py3 compatible, so skip if not installed | # eventlet is not yet py3 compatible, so skip if not installed | ||||||
| eventlet = importutils.try_import('eventlet') | eventlet = importutils.try_import('eventlet') | ||||||
|  |  | ||||||
| impl_zmq = importutils.try_import('oslo.messaging._drivers.impl_zmq') | impl_zmq = importutils.try_import('oslo_messaging._drivers.impl_zmq') | ||||||
|  |  | ||||||
| LOG = logging.getLogger(__name__) | LOG = logging.getLogger(__name__) | ||||||
|  |  | ||||||
| @@ -45,7 +50,7 @@ def get_unused_port(): | |||||||
| class ZmqBaseTestCase(test_utils.BaseTestCase): | class ZmqBaseTestCase(test_utils.BaseTestCase): | ||||||
|     """Base test case for all ZMQ tests that make use of the ZMQ Proxy""" |     """Base test case for all ZMQ tests that make use of the ZMQ Proxy""" | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(ZmqBaseTestCase, self).setUp() |         super(ZmqBaseTestCase, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -73,7 +78,7 @@ class ZmqBaseTestCase(test_utils.BaseTestCase): | |||||||
|  |  | ||||||
| class TestConfZmqDriverLoad(test_utils.BaseTestCase): | class TestConfZmqDriverLoad(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestConfZmqDriverLoad, self).setUp() |         super(TestConfZmqDriverLoad, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -111,7 +116,7 @@ class TestZmqBasics(ZmqBaseTestCase): | |||||||
|             self.driver.send, |             self.driver.send, | ||||||
|             target, {}, {'tx_id': 1}, wait_for_reply=True) |             target, {}, {'tx_id': 1}, wait_for_reply=True) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqIncomingMessage') |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqIncomingMessage') | ||||||
|     def test_send_receive_topic(self, mock_msg): |     def test_send_receive_topic(self, mock_msg): | ||||||
|         """Call() with method.""" |         """Call() with method.""" | ||||||
|         mock_msg.return_value = msg = mock.MagicMock() |         mock_msg.return_value = msg = mock.MagicMock() | ||||||
| @@ -129,7 +134,7 @@ class TestZmqBasics(ZmqBaseTestCase): | |||||||
|             wait_for_reply=True) |             wait_for_reply=True) | ||||||
|         self.assertEqual(result, True) |         self.assertEqual(result, True) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._call', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._call', autospec=True) | ||||||
|     def test_send_receive_fanout(self, mock_call): |     def test_send_receive_fanout(self, mock_call): | ||||||
|         target = messaging.Target(topic='testtopic', fanout=True) |         target = messaging.Target(topic='testtopic', fanout=True) | ||||||
|         self.driver.listen(target) |         self.driver.listen(target) | ||||||
| @@ -149,7 +154,7 @@ class TestZmqBasics(ZmqBaseTestCase): | |||||||
|             {'tx_id': 1, 'method': 'hello-world'}, |             {'tx_id': 1, 'method': 'hello-world'}, | ||||||
|             None, False, []) |             None, False, []) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._call', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._call', autospec=True) | ||||||
|     def test_send_receive_direct(self, mock_call): |     def test_send_receive_direct(self, mock_call): | ||||||
|         # Also verifies fix for bug http://pad.lv/1301723 |         # Also verifies fix for bug http://pad.lv/1301723 | ||||||
|         target = messaging.Target(topic='testtopic', server='localhost') |         target = messaging.Target(topic='testtopic', server='localhost') | ||||||
| @@ -173,7 +178,7 @@ class TestZmqBasics(ZmqBaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqSocket(test_utils.BaseTestCase): | class TestZmqSocket(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestZmqSocket, self).setUp() |         super(TestZmqSocket, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -181,8 +186,8 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|         transport = messaging.get_transport(self.conf) |         transport = messaging.get_transport(self.conf) | ||||||
|         self.driver = transport._driver |         self.driver = transport._driver | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqSocket.subscribe') |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqSocket.subscribe') | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.zmq.Context') |     @mock.patch('oslo_messaging._drivers.impl_zmq.zmq.Context') | ||||||
|     def test_zmqsocket_init_type_pull(self, mock_context, mock_subscribe): |     def test_zmqsocket_init_type_pull(self, mock_context, mock_subscribe): | ||||||
|         mock_ctxt = mock.Mock() |         mock_ctxt = mock.Mock() | ||||||
|         mock_context.return_value = mock_ctxt |         mock_context.return_value = mock_ctxt | ||||||
| @@ -200,8 +205,8 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|         self.assertTrue(mock_sock.connect.called) |         self.assertTrue(mock_sock.connect.called) | ||||||
|         self.assertFalse(mock_sock.bind.called) |         self.assertFalse(mock_sock.bind.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqSocket.subscribe') |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqSocket.subscribe') | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.zmq.Context') |     @mock.patch('oslo_messaging._drivers.impl_zmq.zmq.Context') | ||||||
|     def test_zmqsocket_init_type_sub(self, mock_context, mock_subscribe): |     def test_zmqsocket_init_type_sub(self, mock_context, mock_subscribe): | ||||||
|         mock_ctxt = mock.Mock() |         mock_ctxt = mock.Mock() | ||||||
|         mock_context.return_value = mock_ctxt |         mock_context.return_value = mock_ctxt | ||||||
| @@ -219,8 +224,8 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|         self.assertTrue(mock_sock.connect.called) |         self.assertTrue(mock_sock.connect.called) | ||||||
|         self.assertFalse(mock_sock.bind.called) |         self.assertFalse(mock_sock.bind.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqSocket.subscribe') |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqSocket.subscribe') | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.zmq.Context') |     @mock.patch('oslo_messaging._drivers.impl_zmq.zmq.Context') | ||||||
|     def test_zmqsocket_init_type_push(self, mock_context, mock_subscribe): |     def test_zmqsocket_init_type_push(self, mock_context, mock_subscribe): | ||||||
|         mock_ctxt = mock.Mock() |         mock_ctxt = mock.Mock() | ||||||
|         mock_context.return_value = mock_ctxt |         mock_context.return_value = mock_ctxt | ||||||
| @@ -238,8 +243,8 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|         self.assertTrue(mock_sock.connect.called) |         self.assertTrue(mock_sock.connect.called) | ||||||
|         self.assertFalse(mock_sock.bind.called) |         self.assertFalse(mock_sock.bind.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqSocket.subscribe') |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqSocket.subscribe') | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.zmq.Context') |     @mock.patch('oslo_messaging._drivers.impl_zmq.zmq.Context') | ||||||
|     def test_zmqsocket_init_type_pub(self, mock_context, mock_subscribe): |     def test_zmqsocket_init_type_pub(self, mock_context, mock_subscribe): | ||||||
|         mock_ctxt = mock.Mock() |         mock_ctxt = mock.Mock() | ||||||
|         mock_context.return_value = mock_ctxt |         mock_context.return_value = mock_ctxt | ||||||
| @@ -260,7 +265,7 @@ class TestZmqSocket(test_utils.BaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqIncomingMessage(test_utils.BaseTestCase): | class TestZmqIncomingMessage(test_utils.BaseTestCase): | ||||||
|  |  | ||||||
|     @testtools.skipIf(impl_zmq is None, "zmq not available") |     @testtools.skipIf(zmq is None, "zmq not available") | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|         super(TestZmqIncomingMessage, self).setUp() |         super(TestZmqIncomingMessage, self).setUp() | ||||||
|         self.messaging_conf.transport_driver = 'zmq' |         self.messaging_conf.transport_driver = 'zmq' | ||||||
| @@ -281,7 +286,7 @@ class TestZmqIncomingMessage(test_utils.BaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqConnection(ZmqBaseTestCase): | class TestZmqConnection(ZmqBaseTestCase): | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqReactor', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqReactor', autospec=True) | ||||||
|     def test_zmqconnection_create_consumer(self, mock_reactor): |     def test_zmqconnection_create_consumer(self, mock_reactor): | ||||||
|  |  | ||||||
|         mock_reactor.register = mock.Mock() |         mock_reactor.register = mock.Mock() | ||||||
| @@ -308,7 +313,7 @@ class TestZmqConnection(ZmqBaseTestCase): | |||||||
|                                                  subscribe='subscriber.foo', |                                                  subscribe='subscriber.foo', | ||||||
|                                                  in_bind=False) |                                                  in_bind=False) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqReactor', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqReactor', autospec=True) | ||||||
|     def test_zmqconnection_create_consumer_topic_exists(self, mock_reactor): |     def test_zmqconnection_create_consumer_topic_exists(self, mock_reactor): | ||||||
|         mock_reactor.register = mock.Mock() |         mock_reactor.register = mock.Mock() | ||||||
|         conn = impl_zmq.Connection(self.driver) |         conn = impl_zmq.Connection(self.driver) | ||||||
| @@ -325,9 +330,9 @@ class TestZmqConnection(ZmqBaseTestCase): | |||||||
|         conn.create_consumer(topic, context) |         conn.create_consumer(topic, context) | ||||||
|         self.assertFalse(conn.reactor.register.called) |         self.assertFalse(conn.reactor.register.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._get_matchmaker', |     @mock.patch('oslo_messaging._drivers.impl_zmq._get_matchmaker', | ||||||
|                 autospec=True) |                 autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqReactor', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqReactor', autospec=True) | ||||||
|     def test_zmqconnection_close(self, mock_reactor, mock_getmatchmaker): |     def test_zmqconnection_close(self, mock_reactor, mock_getmatchmaker): | ||||||
|         conn = impl_zmq.Connection(self.driver) |         conn = impl_zmq.Connection(self.driver) | ||||||
|         conn.reactor.close = mock.Mock() |         conn.reactor.close = mock.Mock() | ||||||
| @@ -336,16 +341,16 @@ class TestZmqConnection(ZmqBaseTestCase): | |||||||
|         self.assertTrue(mock_getmatchmaker.return_value.stop_heartbeat.called) |         self.assertTrue(mock_getmatchmaker.return_value.stop_heartbeat.called) | ||||||
|         self.assertTrue(conn.reactor.close.called) |         self.assertTrue(conn.reactor.close.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqReactor', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqReactor', autospec=True) | ||||||
|     def test_zmqconnection_wait(self, mock_reactor): |     def test_zmqconnection_wait(self, mock_reactor): | ||||||
|         conn = impl_zmq.Connection(self.driver) |         conn = impl_zmq.Connection(self.driver) | ||||||
|         conn.reactor.wait = mock.Mock() |         conn.reactor.wait = mock.Mock() | ||||||
|         conn.wait() |         conn.wait() | ||||||
|         self.assertTrue(conn.reactor.wait.called) |         self.assertTrue(conn.reactor.wait.called) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._get_matchmaker', |     @mock.patch('oslo_messaging._drivers.impl_zmq._get_matchmaker', | ||||||
|                 autospec=True) |                 autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqReactor', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqReactor', autospec=True) | ||||||
|     def test_zmqconnection_consume_in_thread(self, mock_reactor, |     def test_zmqconnection_consume_in_thread(self, mock_reactor, | ||||||
|                                              mock_getmatchmaker): |                                              mock_getmatchmaker): | ||||||
|         mock_getmatchmaker.return_value.start_heartbeat = mock.Mock() |         mock_getmatchmaker.return_value.start_heartbeat = mock.Mock() | ||||||
| @@ -368,8 +373,9 @@ class TestZmqListener(ZmqBaseTestCase): | |||||||
|         kwargs = {'a': 1, 'b': 2} |         kwargs = {'a': 1, 'b': 2} | ||||||
|         m = mock.Mock() |         m = mock.Mock() | ||||||
|         ctxt = mock.Mock(autospec=impl_zmq.RpcContext) |         ctxt = mock.Mock(autospec=impl_zmq.RpcContext) | ||||||
|         eventlet.spawn_n(listener.dispatch, ctxt, 0, |         message = {'namespace': 'name.space', 'method': m.fake_method, | ||||||
|                          m.fake_method, 'name.space', **kwargs) |                    'args': kwargs} | ||||||
|  |         eventlet.spawn_n(listener.dispatch, ctxt, message) | ||||||
|         resp = listener.poll(timeout=10) |         resp = listener.poll(timeout=10) | ||||||
|         msg = {'method': m.fake_method, 'namespace': 'name.space', |         msg = {'method': m.fake_method, 'namespace': 'name.space', | ||||||
|                'args': kwargs} |                'args': kwargs} | ||||||
| @@ -378,8 +384,8 @@ class TestZmqListener(ZmqBaseTestCase): | |||||||
|  |  | ||||||
| class TestZmqDriver(ZmqBaseTestCase): | class TestZmqDriver(ZmqBaseTestCase): | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._cast', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._cast', autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._multi_send', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._multi_send', autospec=True) | ||||||
|     def test_zmqdriver_send(self, mock_multi_send, mock_cast): |     def test_zmqdriver_send(self, mock_multi_send, mock_cast): | ||||||
|         context = mock.Mock(autospec=impl_zmq.RpcContext) |         context = mock.Mock(autospec=impl_zmq.RpcContext) | ||||||
|         topic = 'testtopic' |         topic = 'testtopic' | ||||||
| @@ -390,8 +396,8 @@ class TestZmqDriver(ZmqBaseTestCase): | |||||||
|                                            allowed_remote_exmods=[], |                                            allowed_remote_exmods=[], | ||||||
|                                            envelope=False) |                                            envelope=False) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._cast', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._cast', autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq._multi_send', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq._multi_send', autospec=True) | ||||||
|     def test_zmqdriver_send_notification(self, mock_multi_send, mock_cast): |     def test_zmqdriver_send_notification(self, mock_multi_send, mock_cast): | ||||||
|         context = mock.Mock(autospec=impl_zmq.RpcContext) |         context = mock.Mock(autospec=impl_zmq.RpcContext) | ||||||
|         topic = 'testtopic.foo' |         topic = 'testtopic.foo' | ||||||
| @@ -403,8 +409,8 @@ class TestZmqDriver(ZmqBaseTestCase): | |||||||
|                                            msg, allowed_remote_exmods=[], |                                            msg, allowed_remote_exmods=[], | ||||||
|                                            envelope=False) |                                            envelope=False) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqListener', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqListener', autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.Connection', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.Connection', autospec=True) | ||||||
|     def test_zmqdriver_listen(self, mock_connection, mock_listener): |     def test_zmqdriver_listen(self, mock_connection, mock_listener): | ||||||
|         mock_listener.return_value = listener = mock.Mock() |         mock_listener.return_value = listener = mock.Mock() | ||||||
|         mock_connection.return_value = conn = mock.Mock() |         mock_connection.return_value = conn = mock.Mock() | ||||||
| @@ -414,8 +420,8 @@ class TestZmqDriver(ZmqBaseTestCase): | |||||||
|         self.driver.listen(messaging.Target(topic=topic)) |         self.driver.listen(messaging.Target(topic=topic)) | ||||||
|         conn.create_consumer.assert_called_with(topic, listener, fanout=True) |         conn.create_consumer.assert_called_with(topic, listener, fanout=True) | ||||||
|  |  | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.ZmqListener', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.ZmqListener', autospec=True) | ||||||
|     @mock.patch('oslo.messaging._drivers.impl_zmq.Connection', autospec=True) |     @mock.patch('oslo_messaging._drivers.impl_zmq.Connection', autospec=True) | ||||||
|     def test_zmqdriver_listen_for_notification(self, mock_connection, |     def test_zmqdriver_listen_for_notification(self, mock_connection, | ||||||
|                                                mock_listener): |                                                mock_listener): | ||||||
|         mock_listener.return_value = listener = mock.Mock() |         mock_listener.return_value = listener = mock.Mock() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 James Page
					James Page