[Python-modules-commits] [python-ws4py] 03/06: Fix tests

Sandro Tosi morph at moszumanska.debian.org
Mon Feb 20 02:05:00 UTC 2017


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

morph pushed a commit to branch master
in repository python-ws4py.

commit 3722f5ece7e22ed67a84bfaae464853a146d2eb4
Author: Stein Magnus Jodal <jodal at debian.org>
Date:   Thu Nov 5 15:46:08 2015 +0100

    Fix tests
    
    Based on upstream commits:
    - b5d47f7b3497f1b713a20fe6306b7d9afdd8c408
    - b2a76a33960040d7d3d27c68bf17c12f169f81c7
    
    fix unittest failing on 1 CPU machines
---
 test/test_manager.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/test/test_manager.py b/test/test_manager.py
index 8c229b0..fceb77d 100644
--- a/test/test_manager.py
+++ b/test/test_manager.py
@@ -16,10 +16,10 @@ class WSManagerTest(unittest.TestCase):
         ws.sock.fileno.return_value = 1
         
         m.add(ws)
-        m.poller.register.assert_call_once_with(ws)
+        m.poller.register.assert_called_once_with(1)
 
         m.remove(ws)
-        m.poller.unregister.assert_call_once_with(ws)
+        m.poller.unregister.assert_called_once_with(1)
         
     @patch('ws4py.manager.SelectPoller')
     def test_cannot_add_websocket_more_than_once(self, MockSelectPoller):
@@ -49,7 +49,7 @@ class WSManagerTest(unittest.TestCase):
         self.assertEqual(len(m), 1)
         m.remove(ws)
         self.assertEqual(len(m), 0)
-        m.poller.unregister.assert_call_once_with(ws)
+        m.poller.unregister.assert_called_once_with(1)
         m.poller.reset_mock()
         
         m.remove(ws)
@@ -62,6 +62,7 @@ class WSManagerTest(unittest.TestCase):
         self.assertFalse(m.running)
         
         m.start()
+        time.sleep(0.2)
         self.assertTrue(m.running)
 
         m.stop()
@@ -97,8 +98,9 @@ class WSManagerTest(unittest.TestCase):
         
         m.add(ws)
         m.start()
+        time.sleep(0.2)
         
-        ws.terminate.assert_call_once_with()
+        ws.terminate.assert_called_once_with()
         
         m.stop()
     
@@ -109,7 +111,7 @@ class WSManagerTest(unittest.TestCase):
         ws = MagicMock()
         m.add(ws)
         m.close_all()
-        ws.terminate.assert_call_once_with(1001, 'Server is shutting down')
+        ws.close.assert_called_once_with(code=1001, reason='Server is shutting down')
         
     @patch('ws4py.manager.SelectPoller')
     def test_broadcast(self, MockSelectPoller):
@@ -120,7 +122,7 @@ class WSManagerTest(unittest.TestCase):
         m.add(ws)
 
         m.broadcast(b'hello there')
-        ws.send.assert_call_once_with(b'hello there')
+        ws.send.assert_called_once_with(b'hello there', False)
         
     @patch('ws4py.manager.SelectPoller')
     def test_broadcast_failure_must_not_break_caller(self, MockSelectPoller):

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



More information about the Python-modules-commits mailing list