Fix inject/extract_from_urllib3 in tests
MODIFY
test/contrib/test_pyopenssl.py
test/contrib/test_pyopenssl.py
@@ -25,7 +25,7 @@ def setup_module():
def teardown_module():
try:
- from urllib3.contrib.securetransport import extract_from_urllib3
+ from urllib3.contrib.pyopenssl import extract_from_urllib3
extract_from_urllib3()
except ImportError:
pass

MODIFY
test/contrib/test_pyopenssl_dependencies.py
test/contrib/test_pyopenssl_dependencies.py
@@ -15,11 +15,20 @@ except ImportError:
def setup_module():
try:
- from urllib3.contrib.pyopenssl import inject_into_urllib3 # noqa: F401
+ from urllib3.contrib.pyopenssl import inject_into_urllib3
+ inject_into_urllib3()
except ImportError as e:
pytest.skip('Could not import PyOpenSSL: %r' % e)
+def teardown_module():
+ try:
+ from urllib3.contrib.pyopenssl import extract_from_urllib3
+ extract_from_urllib3()
+ except ImportError:
+ pass
+
+
class TestPyOpenSSLInjection(unittest.TestCase):
"""
Tests for error handling in pyopenssl's 'inject_into urllib3'

Fix inject/extract_from_urllib3 in tests (#1480)