From c793ac4bfebf46f3450c326692764271ece2d3ba Mon Sep 17 00:00:00 2001 From: liris Date: Fri, 16 May 2014 09:15:06 +0900 Subject: - work on python2.6 --- setup.py | 5 ++++- tests/test_websocket.py | 10 +++++++++- 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) -- cgit v1.2.1