forked from pool/python-websocket-client
Accepting request 285686 from home:rjschwei:branches:devel:languages:python
- Update fixTestTimeoutIssue.patch to handle different behavior between python 2.7.x versions - Add fixTestTimeoutIssue.patch + fixes test case in factory OBS-URL: https://build.opensuse.org/request/show/285686 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-websocket-client?expand=0&rev=4
This commit is contained in:
committed by
Git OBS Bridge
parent
98379f4522
commit
e763967fee
35
fixTestTimeoutIssue.patch
Normal file
35
fixTestTimeoutIssue.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
--- websocket/tests/test_websocket.py.orig
|
||||
+++ websocket/tests/test_websocket.py
|
||||
@@ -37,6 +37,17 @@ TEST_WITH_INTERNET = False
|
||||
TEST_SECURE_WS = False
|
||||
TRACABLE = False
|
||||
|
||||
+def _versionGreater(targetVer):
|
||||
+ """Returns true if the interpreter version is greater than the given
|
||||
+ target version"""
|
||||
+ interpretVer = sys.version.split()[0]
|
||||
+ for i in range(len(interpretVer)):
|
||||
+ if interpretVer[i] == '.':
|
||||
+ continue
|
||||
+ if int(interpretVer[i]) > int(targetVer[i]):
|
||||
+ return 1
|
||||
+
|
||||
+ return None
|
||||
|
||||
def create_mask_key(n):
|
||||
return "abcd"
|
||||
@@ -261,8 +272,12 @@ class WebSocketTest(unittest.TestCase):
|
||||
s.add_packet(six.b("baz"))
|
||||
with self.assertRaises(ws.WebSocketTimeoutException):
|
||||
data = sock._recv_strict(9)
|
||||
- with self.assertRaises(SSLError):
|
||||
- data = sock._recv_strict(9)
|
||||
+ if six.PY2 and _versionGreater('2.7.8'):
|
||||
+ with self.assertRaises(ws.WebSocketTimeoutException):
|
||||
+ data = sock._recv_strict(9)
|
||||
+ else:
|
||||
+ with self.assertRaises(SSLError):
|
||||
+ data = sock._recv_strict(9)
|
||||
data = sock._recv_strict(9)
|
||||
self.assertEqual(data, six.b("foobarbaz"))
|
||||
with self.assertRaises(ws.WebSocketConnectionClosedException):
|
||||
Reference in New Issue
Block a user