F401 Entity imported but unused
MODIFY
test/__init__.py
test/__init__.py
@@ -7,7 +7,7 @@ import socket
from nose.plugins.skip import SkipTest
-from urllib3.exceptions import MaxRetryError, HTTPWarning
+from urllib3.exceptions import HTTPWarning
from urllib3.packages import six
# We need a host that will not immediately close the connection with a TCP

MODIFY
test/contrib/test_pyopenssl.py
test/contrib/test_pyopenssl.py
import unittest
from nose.plugins.skip import SkipTest
-from urllib3.packages import six
try:
from urllib3.contrib.pyopenssl import (inject_into_urllib3,
@@ -12,10 +11,6 @@ except ImportError as e:
raise SkipTest('Could not import PyOpenSSL: %r' % e)
-from ..with_dummyserver.test_https import TestHTTPS, TestHTTPS_TLSv1
-from ..with_dummyserver.test_socketlevel import TestSNI, TestSocketClosing
-
-
def setup_module():
inject_into_urllib3()

MODIFY
test/test_connection.py
test/test_connection.py
@@ -9,7 +9,6 @@ import mock
from urllib3.connection import (
CertificateError,
- VerifiedHTTPSConnection,
_match_hostname,
RECENT_DATE
)

MODIFY
test/test_fields.py
test/test_fields.py
import unittest
from urllib3.fields import guess_content_type, RequestField
-from urllib3.packages.six import u, PY3
+from urllib3.packages.six import u
from . import onlyPy2

MODIFY
test/test_no_ssl.py
test/test_no_ssl.py
@@ -81,9 +81,9 @@ class TestImportWithoutSSL(TestWithoutSSL):
# importlib.
# 'import' inside 'lambda' is invalid syntax.
def import_ssl():
- import ssl
+ import ssl # noqa: F401
self.assertRaises(ImportError, import_ssl)
def test_import_urllib3(self):
- import urllib3
+ import urllib3 # noqa: F401

MODIFY
test/test_selectors.py
test/test_selectors.py
@@ -9,10 +9,10 @@ import time
import threading
try: # Python 2.6 unittest module doesn't have skip decorators.
- from unittest import skip, skipIf, skipUnless
+ from unittest import skipIf, skipUnless
import unittest
except ImportError:
- from unittest2 import skip, skipIf, skipUnless
+ from unittest2 import skipIf, skipUnless
import unittest2 as unittest
try: # Python 2.x doesn't define time.perf_counter.
@@ -123,7 +123,7 @@ class BaseSelectorTestCase(unittest.TestCase, AlarmMixin, TimerMixin):
SELECTOR = selectors.DefaultSelector
def make_socketpair(self):
- rd, wr = socket.socketpair()
+ rd, wr = socketpair()
# Make non-blocking so we get errors if the
# sockets are interacted with but not ready.

MODIFY
test/test_util.py
test/test_util.py
@@ -29,7 +29,6 @@ from urllib3.exceptions import (
LocationParseError,
TimeoutStateError,
InsecureRequestWarning,
- SSLError,
SNIMissingWarning,
InvalidHeader,
UnrewindableBodyError,

MODIFY
test/with_dummyserver/test_connectionpool.py
test/with_dummyserver/test_connectionpool.py
-import errno
import io
import logging
import socket
@@ -7,13 +6,9 @@ import unittest
import time
import warnings
-from datetime import datetime
-from datetime import timedelta
-
import mock
from .. import (
- requires_network, onlyPy3, onlyPy26OrOlder,
TARPIT_HOST, VALID_SOURCE_ADDRESSES, INVALID_SOURCE_ADDRESSES,
)
from ..port_helpers import find_unused_port
@@ -27,7 +22,6 @@ from urllib3.exceptions import (
DecodeError,
MaxRetryError,
ReadTimeoutError,
- ProtocolError,
NewConnectionError,
UnrewindableBodyError,
)

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -21,7 +21,6 @@ from test import (
onlyPy279OrNewer,
requires_network,
TARPIT_HOST,
- clear_warnings,
)
from urllib3 import HTTPSConnectionPool
from urllib3.connection import (
@@ -31,7 +30,6 @@ from urllib3.connection import (
)
from urllib3.exceptions import (
SSLError,
- ReadTimeoutError,
ConnectTimeoutError,
InsecureRequestWarning,
SystemTimeWarning,

MODIFY
test/with_dummyserver/test_poolmanager.py
test/with_dummyserver/test_poolmanager.py
@@ -7,7 +7,7 @@ from dummyserver.testcase import (HTTPDummyServerTestCase,
IPv6HTTPDummyServerTestCase)
from urllib3.poolmanager import PoolManager
from urllib3.connectionpool import port_by_scheme
-from urllib3.exceptions import MaxRetryError, SSLError
+from urllib3.exceptions import MaxRetryError
from urllib3.util.retry import Retry

MODIFY
test/with_dummyserver/test_socketlevel.py
test/with_dummyserver/test_socketlevel.py
@@ -6,7 +6,6 @@ from urllib3.poolmanager import proxy_from_url
from urllib3.exceptions import (
MaxRetryError,
ProxyError,
- ConnectTimeoutError,
ReadTimeoutError,
SSLError,
ProtocolError,

F401 Entity imported but unused