diff --git a/newrelic/packages/urllib3/contrib/_securetransport/bindings.py b/newrelic/packages/urllib3/contrib/_securetransport/bindings.py index 11524d400..264d564db 100644 --- a/newrelic/packages/urllib3/contrib/_securetransport/bindings.py +++ b/newrelic/packages/urllib3/contrib/_securetransport/bindings.py @@ -48,7 +48,7 @@ ) from ctypes.util import find_library -from urllib3.packages.six import raise_from +from ...packages.six import raise_from if platform.system() != "Darwin": raise ImportError("Only macOS is supported") diff --git a/newrelic/packages/urllib3/util/ssltransport.py b/newrelic/packages/urllib3/util/ssltransport.py index c2186bced..4a7105d17 100644 --- a/newrelic/packages/urllib3/util/ssltransport.py +++ b/newrelic/packages/urllib3/util/ssltransport.py @@ -2,8 +2,8 @@ import socket import ssl -from urllib3.exceptions import ProxySchemeUnsupported -from urllib3.packages import six +from ..exceptions import ProxySchemeUnsupported +from ..packages import six SSL_BLOCKSIZE = 16384 diff --git a/tests/adapter_gevent/test_patch_thread.py b/tests/adapter_gevent/test_patching.py similarity index 60% rename from tests/adapter_gevent/test_patch_thread.py rename to tests/adapter_gevent/test_patching.py index 41fdab2cc..4451d9823 100644 --- a/tests/adapter_gevent/test_patch_thread.py +++ b/tests/adapter_gevent/test_patching.py @@ -12,8 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -import gevent.monkey - def test_patch_thread(): + import gevent.monkey + gevent.monkey.patch_thread() + + +def test_patch_ssl_recursion(): + import gevent.monkey + + gevent.monkey.patch_all() + + # Delay imports and test creation of contexts from both bundled and installed urllib3 + import urllib3.util.ssl_ + + import newrelic.packages.urllib3.util.ssl_ + + context1 = urllib3.util.ssl_.create_urllib3_context() + context2 = newrelic.packages.urllib3.util.ssl_.create_urllib3_context() diff --git a/tox.ini b/tox.ini index 60ac0ee35..53a41f19d 100644 --- a/tox.ini +++ b/tox.ini @@ -157,6 +157,7 @@ deps = adapter_cheroot: cheroot adapter_gevent: WSGIProxy2 adapter_gevent: gevent + adapter_gevent: urllib3 adapter_gunicorn-aiohttp1: aiohttp<2.0 adapter_gunicorn-aiohttp3: aiohttp<4.0 adapter_gunicorn-gunicorn19: gunicorn<20