From 0e4300e6518dc862d2a6444ddbed49723fae638e Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 10 Feb 2015 16:13:18 +0100 Subject: [PATCH] Refreshed patche --- debian/patches/disable-kombu-3-test.patch | 29 +++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/debian/patches/disable-kombu-3-test.patch b/debian/patches/disable-kombu-3-test.patch index 8149654a..803a2eb8 100644 --- a/debian/patches/disable-kombu-3-test.patch +++ b/debian/patches/disable-kombu-3-test.patch @@ -7,11 +7,11 @@ Description: Disable test that requires Kombu 3.x This patch neutralise the test cases, which otherwise pass. Author: Thomas Goirand Forwarded: no -Last-Update: 2014-10-01 +Last-Update: 2015-02-10 ---- a/taskflow/tests/unit/worker_based/test_dispatcher.py 2014-10-01 10:39:54.000000000 +0000 -+++ /dev/null 2013-06-03 14:59:59.000000000 +0000 -@@ -1,77 +0,0 @@ +--- a/taskflow/tests/unit/worker_based/test_dispatcher.py 2015-02-10 15:58:00.000000000 +0100 ++++ /dev/null 2015-02-06 22:50:20.582883760 +0100 +@@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved. @@ -28,11 +28,14 @@ Last-Update: 2014-10-01 -# License for the specific language governing permissions and limitations -# under the License. - --from kombu import message --import mock +-try: +- from kombu import message # noqa +-except ImportError: +- from kombu.transport import base as message - -from taskflow.engines.worker_based import dispatcher -from taskflow import test +-from taskflow.test import mock - - -def mock_acked_message(ack_ok=True, **kwargs): @@ -48,16 +51,16 @@ Last-Update: 2014-10-01 - return msg - - --class TestDispatcher(test.MockTestCase): +-class TestDispatcher(test.TestCase): - def test_creation(self): - on_hello = mock.MagicMock() - handlers = {'hello': on_hello} -- dispatcher.TypeDispatcher(handlers) +- dispatcher.TypeDispatcher(type_handlers=handlers) - - def test_on_message(self): - on_hello = mock.MagicMock() - handlers = {'hello': on_hello} -- d = dispatcher.TypeDispatcher(handlers) +- d = dispatcher.TypeDispatcher(type_handlers=handlers) - msg = mock_acked_message(properties={'type': 'hello'}) - d.on_message("", msg) - self.assertTrue(on_hello.called) @@ -65,15 +68,15 @@ Last-Update: 2014-10-01 - self.assertTrue(msg.acknowledged) - - def test_on_rejected_message(self): -- d = dispatcher.TypeDispatcher({}) +- d = dispatcher.TypeDispatcher() - msg = mock_acked_message(properties={'type': 'hello'}) - d.on_message("", msg) - self.assertTrue(msg.reject_log_error.called) - self.assertFalse(msg.acknowledged) - - def test_on_requeue_message(self): -- d = dispatcher.TypeDispatcher({}) -- d.add_requeue_filter(lambda data, message: True) +- d = dispatcher.TypeDispatcher() +- d.requeue_filters.append(lambda data, message: True) - msg = mock_acked_message() - d.on_message("", msg) - self.assertTrue(msg.requeue.called) @@ -82,7 +85,7 @@ Last-Update: 2014-10-01 - def test_failed_ack(self): - on_hello = mock.MagicMock() - handlers = {'hello': on_hello} -- d = dispatcher.TypeDispatcher(handlers) +- d = dispatcher.TypeDispatcher(type_handlers=handlers) - msg = mock_acked_message(ack_ok=False, - properties={'type': 'hello'}) - d.on_message("", msg)