From 6ab3cfc1aeea01350963eea82ff45dc13e46d4aa Mon Sep 17 00:00:00 2001 From: Tomas Hrnciar Date: Thu, 24 Sep 2020 12:05:37 +0200 Subject: [PATCH] Move requests_unixsocket import outside of fetch_url() --- notebook/tests/launchnotebook.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/notebook/tests/launchnotebook.py b/notebook/tests/launchnotebook.py index 25ce8c81684..1e6eb025b7e 100644 --- a/notebook/tests/launchnotebook.py +++ b/notebook/tests/launchnotebook.py @@ -16,6 +16,8 @@ from unittest.mock import patch import requests +if os.name != 'nt': + import requests_unixsocket from tornado.ioloop import IOLoop import zmq @@ -230,9 +232,6 @@ def base_url(cls): @staticmethod def fetch_url(url): - # Lazily import so it is not required at the module level - if os.name != 'nt': - import requests_unixsocket with requests_unixsocket.monkeypatch(): return requests.get(url)