summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliris <liris.pp@gmail.com>2014-05-16 09:15:06 +0900
committerliris <liris.pp@gmail.com>2014-05-16 09:15:06 +0900
commitc793ac4bfebf46f3450c326692764271ece2d3ba (patch)
tree9e9b541bae4674ffc341d94d140ca83bdddc59fd
parentf6da33e6f292ef3e0ca21d9bbe8d7ab541d649a1 (diff)
downloadwebsocket-client-c793ac4bfebf46f3450c326692764271ece2d3ba.tar.gz
- work on python2.6
-rw-r--r--setup.py5
-rw-r--r--tests/test_websocket.py10
2 files changed, 13 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 56d3f3e..fdd64fd 100644
--- a/setup.py
+++ b/setup.py
@@ -4,9 +4,12 @@ import sys
VERSION = "0.14.0"
install_requires = ["six"]
-if sys.version_info.major == 2:
+if sys.version_info[0] == 2:
name="websocket-client"
install_requires.append('backports.ssl_match_hostname')
+ if sys.version_info[1] < 7:
+ install_requires.append('unittest2')
+ install_requires.append('argparse')
else:
# for backword compatible.
name="websocket-client-py3"
diff --git a/tests/test_websocket.py b/tests/test_websocket.py
index b34c79a..94b1cb7 100644
--- a/tests/test_websocket.py
+++ b/tests/test_websocket.py
@@ -14,7 +14,12 @@ except ImportError:
# dummy class of SSLError for ssl none-support environment.
class SSLError(Exception):
pass
-import unittest
+
+if sys.version_info[0] == 2 and sys.version_info[1] < 7:
+ import unittest2 as unittest
+else:
+ import unittest
+
import uuid
# websocket-client
@@ -133,6 +138,9 @@ class WebSocketTest(unittest.TestCase):
self.assertRaises(ValueError, ws._parse_url, "http://www.example.com/r")
+ if sys.version_info[0] == 2 and sys.version_info[1] < 7:
+ return
+
p = ws._parse_url("ws://[2a03:4000:123:83::3]/r")
self.assertEqual(p[0], "2a03:4000:123:83::3")
self.assertEqual(p[1], 80)