Fix flake errors with unittest2 import
MODIFY
test/test_connectionpool.py
test/test_connectionpool.py
from __future__ import absolute_import
import sys
-if sys.version_info >= (2, 7):
- import unittest
-else:
- import unittest2 as unittest
from urllib3.connectionpool import (
connection_from_url,
@@ -35,6 +31,11 @@ from ssl import SSLError as BaseSSLError
from dummyserver.server import DEFAULT_CA
+if sys.version_info >= (2, 7):
+ import unittest
+else:
+ import unittest2 as unittest
+
class TestConnectionPool(unittest.TestCase):
"""

MODIFY
test/test_poolmanager.py
test/test_poolmanager.py
import functools
from collections import namedtuple
import sys
-if sys.version_info >= (2, 7):
- import unittest
-else:
- import unittest2 as unittest
from urllib3.poolmanager import (
_default_key_normalizer,
@@ -21,6 +17,11 @@ from urllib3.exceptions import (
)
from urllib3.util import retry, timeout
+if sys.version_info >= (2, 7):
+ import unittest
+else:
+ import unittest2 as unittest
+
class TestPoolManager(unittest.TestCase):
def test_same_url(self):

MODIFY
test/test_proxymanager.py
test/test_proxymanager.py
import sys
+
+from urllib3.poolmanager import ProxyManager
+
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
-from urllib3.poolmanager import ProxyManager
-
class TestProxyManager(unittest.TestCase):
def test_proxy_headers(self):

MODIFY
test/test_queue_monkeypatch.py
test/test_queue_monkeypatch.py
@@ -2,15 +2,16 @@ from __future__ import absolute_import
import mock
import sys
-if sys.version_info >= (2, 7):
- import unittest
-else:
- import unittest2 as unittest
import urllib3
from urllib3.exceptions import EmptyPoolError
from urllib3.packages.six.moves import queue
+if sys.version_info >= (2, 7):
+ import unittest
+else:
+ import unittest2 as unittest
+
class BadError(Exception):
"""

Fix flake errors with unittest2 import