File: 0001-Fix-tests-on-Python-3.5.2.patch

package info (click to toggle)
python-websockets 3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 352 kB
  • ctags: 438
  • sloc: python: 2,081; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 1,726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 3dc55641e1914ce8c5b39bfbb2bfd4d38c51fa9a Mon Sep 17 00:00:00 2001
From: Julien Enselme <julien.enselme@centrale-marseille.fr>
Date: Sun, 18 Sep 2016 17:48:45 +0200
Subject: Fix tests on Python 3.5.2

get_extra_info is called with 'sslcontext' before being called as
expected. Adapt the tests accordingly.

Close #123
---
 websockets/test_protocol.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/websockets/test_protocol.py b/websockets/test_protocol.py
index 2e256c6..312f7e7 100644
--- a/websockets/test_protocol.py
+++ b/websockets/test_protocol.py
@@ -258,7 +258,10 @@ class CommonTests:
         self.run_loop_once()
         # The connection is established.
         self.assertEqual(self.protocol.local_address, ('host', 4312))
-        get_extra_info.assert_called_once_with('sockname', None)
+        if get_extra_info.call_count == 2:
+            assert get_extra_info.call_args_list == [(('sslcontext',),), (('sockname', None),)]
+        else:
+            get_extra_info.assert_called_once_with('sockname', None)
 
     def test_remote_address(self):
         get_extra_info = unittest.mock.Mock(return_value=('host', 4312))
@@ -268,7 +271,10 @@ class CommonTests:
         self.run_loop_once()
         # The connection is established.
         self.assertEqual(self.protocol.remote_address, ('host', 4312))
-        get_extra_info.assert_called_once_with('peername', None)
+        if get_extra_info.call_count == 2:
+            assert get_extra_info.call_args_list == [(('sslcontext',),), (('peername', None),)]
+        else:
+            get_extra_info.assert_called_once_with('peername', None)
 
     def test_open(self):
         self.assertTrue(self.protocol.open)