[Python-modules-commits] [python-pika] 12/15: Make the test more reliable in Python 3.5

Jan Dittberner jandd at moszumanska.debian.org
Wed Dec 30 13:39:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

jandd pushed a commit to branch master
in repository python-pika.

commit de39689cab64d0c9505636479632e9ae739f8e30
Author: Gavin M. Roy <gavinr at aweber.com>
Date:   Wed Nov 4 17:00:40 2015 -0500

    Make the test more reliable in Python 3.5
---
 tests/unit/heartbeat_tests.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/unit/heartbeat_tests.py b/tests/unit/heartbeat_tests.py
index 9ec496f..62aa777 100644
--- a/tests/unit/heartbeat_tests.py
+++ b/tests/unit/heartbeat_tests.py
@@ -152,8 +152,11 @@ class HeartbeatTests(unittest.TestCase):
         self.assertIsInstance(self.obj._new_heartbeat_frame(), frame.Heartbeat)
 
     def test_send_heartbeat_send_frame_called(self):
-        self.obj._send_heartbeat_frame()
-        self.mock_conn._send_frame.assert_called_once()
+        frame_value = self.obj._new_heartbeat_frame()
+        with mock.patch.object(self.obj, '_new_heartbeat_frame') as new_frame:
+            new_frame.return_value = frame_value
+            self.obj._send_heartbeat_frame()
+            self.mock_conn._send_frame.assert_called_once_with(frame_value)
 
     def test_send_heartbeat_counter_incremented(self):
         self.obj._send_heartbeat_frame()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pika.git



More information about the Python-modules-commits mailing list