e763967fee
- 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
36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
--- 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):
|