Skip TLS test on Windows py26, fix lint issues
MODIFY
test/__init__.py
test/__init__.py
@@ -4,6 +4,7 @@ import errno
import functools
import logging
import socket
+import platform
from nose.plugins.skip import SkipTest
@@ -95,6 +96,17 @@ def onlyPy3(test):
return wrapper
+def onlyPy27OrNewerOrNonWindows(test):
+ """Skips this test unless you are on Python2.7+ or non-Windows"""
+ @functools.wraps(test)
+ def wrapper(*args, **kwargs):
+ msg = "{name} requires Python2.7+ or non-Windows to run".format(name=test.__name__)
+ if sys.version_info < (2, 7) and platform.system() == 'Windows':
+ raise SkipTest(msg)
+ return test(*args, **kwargs)
+ return wrapper
+
+
_requires_network_has_route = None

MODIFY
test/socketpair_helper.py
test/socketpair_helper.py
@@ -4,7 +4,7 @@ try:
_CONNECT_ERROR = (BlockingIOError, InterruptedError)
except:
try:
- _CONNECT_ERROR = (WinError, OSError, socket.error)
+ _CONNECT_ERROR = (WinError, OSError, socket.error) # noqa: F821
except:
_CONNECT_ERROR = (OSError, socket.error)

MODIFY
test/test_selectors.py
test/test_selectors.py
@@ -4,7 +4,6 @@ import os
import psutil
import select
import signal
-import socket
import sys
import time
import threading

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -19,6 +19,7 @@ from dummyserver.server import (DEFAULT_CA, DEFAULT_CA_BAD, DEFAULT_CERTS,
from test import (
onlyPy26OrOlder,
onlyPy279OrNewer,
+ onlyPy27OrNewerOrNonWindows,
requires_network,
TARPIT_HOST,
)
@@ -496,7 +497,11 @@ class TestHTTPS_TLSv1(HTTPSDummyServerTestCase):
self._pool = HTTPSConnectionPool(self.host, self.port)
self.addCleanup(self._pool.close)
+ @onlyPy27OrNewerOrNonWindows
def test_discards_connection_on_sslerror(self):
+ # This test is skipped on Windows for Python 2.6 because we suspect there
+ # is an issue with the OpenSSL for Python 2.6 on Windows.
+
self._pool.cert_reqs = 'CERT_REQUIRED'
self.assertRaises(SSLError, self._pool.request, 'GET', '/')
self._pool.ca_certs = DEFAULT_CA

Skip TLS test on Windows py26, fix lint issues