14
0

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:
Michal Čihař
2015-02-17 10:18:09 +00:00
committed by Git OBS Bridge
parent 98379f4522
commit e763967fee
3 changed files with 49 additions and 0 deletions

35
fixTestTimeoutIssue.patch Normal file
View 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):

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Feb 11 15:57:53 UTC 2015 - rjschwei@suse.com
- Update fixTestTimeoutIssue.patch to handle different behavior between
python 2.7.x versions
-------------------------------------------------------------------
Tue Feb 10 13:20:34 UTC 2015 - rjschwei@suse.com
- Add fixTestTimeoutIssue.patch
+ fixes test case in factory
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Feb 8 13:24:49 UTC 2015 - rjschwei@suse.com Sun Feb 8 13:24:49 UTC 2015 - rjschwei@suse.com

View File

@@ -24,6 +24,7 @@ License: LGPL-2.1
Group: Development/Languages/Python Group: Development/Languages/Python
Url: https://github.com/liris/websocket-client/releases Url: https://github.com/liris/websocket-client/releases
Source0: websocket-client-%{version}.tar.gz Source0: websocket-client-%{version}.tar.gz
Patch0: fixTestTimeoutIssue.patch
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: python-six BuildRequires: python-six
Requires: python Requires: python
@@ -53,6 +54,7 @@ Unit tests for websocket-client
%prep %prep
%setup -q -n websocket-client-%{version} %setup -q -n websocket-client-%{version}
%patch0
%build %build
python setup.py build python setup.py build