[Python-modules-commits] r34007 - in packages/kombu/trunk/debian/patches (2 files)

fladi at users.alioth.debian.org fladi at users.alioth.debian.org
Wed Aug 26 17:50:28 UTC 2015


    Date: Wednesday, August 26, 2015 @ 17:50:27
  Author: fladi
Revision: 34007

Add fix_mock_tests.patch to fix assertions usage in redis tests (Closes: #796438).

Added:
  packages/kombu/trunk/debian/patches/fix_mock_tests.patch
Modified:
  packages/kombu/trunk/debian/patches/series

Added: packages/kombu/trunk/debian/patches/fix_mock_tests.patch
===================================================================
--- packages/kombu/trunk/debian/patches/fix_mock_tests.patch	                        (rev 0)
+++ packages/kombu/trunk/debian/patches/fix_mock_tests.patch	2015-08-26 17:50:27 UTC (rev 34007)
@@ -0,0 +1,83 @@
+Description: Fix various broken mock assertions.
+ Several assertions were using the wrong method name or assumed no parameters.
+Author: Michael Fladischer <fladi at debian.org>
+Last-Update: 2015-08-26
+Forwarded: no
+Index: kombu/kombu/tests/transport/test_qpid.py
+===================================================================
+--- kombu.orig/kombu/tests/transport/test_qpid.py	2015-08-26 19:16:16.983779823 +0200
++++ kombu/kombu/tests/transport/test_qpid.py	2015-08-26 19:16:16.975779660 +0200
+@@ -1152,10 +1152,20 @@
+     def test_queue_declare_raises_exception_not_silenced(self):
+         unique_exception = Exception('This exception should not be silenced')
+         mock_queue = Mock()
++        expected_default_options = {
++            'passive': False,
++            'durable': False,
++            'exclusive': False,
++            'auto-delete': True,
++            'arguments': None,
++            'qpid.policy_type': 'ring',
++        }
+         self.mock_broker.addQueue.side_effect = unique_exception
+         with self.assertRaises(unique_exception.__class__):
+             self.my_channel.queue_declare(mock_queue)
+-        self.mock_broker.addQueue.assert_called_once()
++        self.mock_broker.addQueue.assert_called_once_with(
++            mock_queue, options=expected_default_options
++        )
+ 
+     def test_exchange_declare_raises_exception_and_silenced(self):
+         """Create exchange where an exception is raised and then silenced"""
+@@ -1308,10 +1318,10 @@
+         self.my_channel.basic_publish(
+             mock_message, mock_exchange, mock_routing_key,
+         )
+-        mock_encode_body.assert_called_once(
++        mock_encode_body.assert_called_once_with(
+             mock_original_body, mock_body_encoding,
+         )
+-        mock_buffer.assert_called_once(mock_encode_body)
++        mock_buffer.assert_called_once_with(mock_encoded_body)
+         self.assertIs(mock_message['body'], mock_encoded_buffered_body)
+         self.assertIs(
+             mock_message['properties']['body_encoding'], mock_body_encoding,
+@@ -1567,8 +1577,9 @@
+         self.mock_verify_runtime_environment.assert_called_once_with()
+ 
+     def test_transport___init___calls_parent_class___init__(self):
+-        Transport(Mock())
+-        self.mock_base_Transport__init__.assert_caled_once_with()
++        mock = Mock()
++        Transport(mock)
++        self.mock_base_Transport__init__.assert_called_once_with(mock)
+ 
+     def test_transport___init___calls_os_pipe(self):
+         Transport(Mock())
+Index: kombu/kombu/tests/transport/test_redis.py
+===================================================================
+--- kombu.orig/kombu/tests/transport/test_redis.py	2015-08-26 19:16:16.983779823 +0200
++++ kombu/kombu/tests/transport/test_redis.py	2015-08-26 19:17:33.625343296 +0200
+@@ -578,16 +578,18 @@
+         srem = x.client.srem = Mock()
+ 
+         x._delete('queue', 'exchange', 'routing_key', None)
+-        delete.assert_has_call('queue')
+-        srem.assert_has_call(x.keyprefix_queue % ('exchange', ),
+-                             x.sep.join(['routing_key', '', 'queue']))
++        delete.assert_has_calls([call('queue')])
++        srem.assert_has_calls([
++            call(x.keyprefix_queue % ('exchange', ),
++                 x.sep.join(['routing_key', '', 'queue']))
++        ])
+ 
+     def test_has_queue(self):
+         self.channel._in_poll = False
+         exists = self.channel.client.exists = Mock()
+         exists.return_value = True
+         self.assertTrue(self.channel._has_queue('foo'))
+-        exists.assert_has_call('foo')
++        exists.assert_has_calls([call('foo')])
+ 
+         exists.return_value = False
+         self.assertFalse(self.channel._has_queue('foo'))

Modified: packages/kombu/trunk/debian/patches/series
===================================================================
--- packages/kombu/trunk/debian/patches/series	2015-08-26 16:49:05 UTC (rev 34006)
+++ packages/kombu/trunk/debian/patches/series	2015-08-26 17:50:27 UTC (rev 34007)
@@ -1,2 +1,3 @@
+fix_mock_tests.patch
 remove_logo.patch
 fix_test_pymongo_uri_options.patch




More information about the Python-modules-commits mailing list