Fix skip logic in PyOpenSSL dependencies test
MODIFY
test/contrib/test_pyopenssl_dependencies.py
test/contrib/test_pyopenssl_dependencies.py
# -*- coding: utf-8 -*-
import unittest
-
import pytest
+from mock import patch, Mock
+
try:
- from urllib3.contrib.pyopenssl import (inject_into_urllib3,
- extract_from_urllib3)
-except ImportError as e:
- pytestmark = pytest.mark.skip('Could not import PyOpenSSL: %r' % e)
+ from urllib3.contrib.pyopenssl import (
+ inject_into_urllib3,
+ extract_from_urllib3
+ )
+except ImportError:
+ pass
-from mock import patch, Mock
+
+def setup_module():
+ try:
+ from urllib3.contrib.pyopenssl import inject_into_urllib3
+ except ImportError as e:
+ pytest.skip('Could not import PyOpenSSL: %r' % e)
class TestPyOpenSSLInjection(unittest.TestCase):

Fix skip logic in PyOpenSSL dependencies test