- work on python2.6

This commit is contained in:
liris 2014-05-16 09:15:06 +09:00
parent f6da33e6f2
commit c793ac4bfe
2 changed files with 13 additions and 2 deletions

@ -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"

@ -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)