Account for missing argument in python2.6 HTTPConnection
This is getting a) complicated b) tiresome.
This commit is contained in:
@@ -63,7 +63,7 @@ def test_script_name():
|
||||
http_uninstall()
|
||||
|
||||
|
||||
@py.test.mark.xfail(sys.version_info[0] == 2 and sys.version_info[1] <= 6,
|
||||
py.test.mark.xfail(sys.version_info[0] == 2 and sys.version_info[1] <= 6,
|
||||
reason='works okay on 2.7 and beyond. why?')
|
||||
def test_encoding_errors():
|
||||
http_install()
|
||||
|
||||
@@ -20,8 +20,12 @@ class HTTP_WSGIInterceptorWithTimeout(InterceptorMixin,
|
||||
|
||||
# In Python3 strict is deprecated
|
||||
if sys.version_info[0] < 3:
|
||||
HTTPConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout, source_address=source_address)
|
||||
try:
|
||||
HTTPConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout, source_address=source_address)
|
||||
except TypeError: # Python 2.6 doesn't have source_address
|
||||
HTTPConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout)
|
||||
else:
|
||||
HTTPConnection.__init__(self, host, port=port,
|
||||
timeout=timeout, source_address=source_address)
|
||||
@@ -36,10 +40,14 @@ class HTTPS_WSGIInterceptorWithTimeout(InterceptorMixin,
|
||||
# ignore proxy_info and ca_certs
|
||||
# In Python3 strict is deprecated
|
||||
if sys.version_info[0] < 3:
|
||||
HTTPConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout, source_address=source_address)
|
||||
try:
|
||||
HTTPSConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout, source_address=source_address)
|
||||
except TypeError: # Python 2.6 doesn't have source_address
|
||||
HTTPSConnection.__init__(self, host, port=port, strict=strict,
|
||||
timeout=timeout)
|
||||
else:
|
||||
HTTPConnection.__init__(self, host, port=port,
|
||||
HTTPSConnection.__init__(self, host, port=port,
|
||||
timeout=timeout, source_address=source_address)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user