Skip to content

Commit

Permalink
Prevent inclusion of requests_unixsocket on Windows (#5650)
Browse files Browse the repository at this point in the history
* Prevent inclusion of requests_unixsocket on Windows

* lazily import

Co-authored-by: Steven Silvester <stslve@amazon.com>
  • Loading branch information
kevin-bates and Steven Silvester authored Aug 3, 2020
1 parent a8fbe7d commit 73e6c27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion notebook/tests/launchnotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from unittest.mock import patch

import requests
import requests_unixsocket
from tornado.ioloop import IOLoop
import zmq

Expand Down Expand Up @@ -231,6 +230,9 @@ 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)

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@
],
extras_require = {
'test': ['nose', 'coverage', 'requests', 'nose_warnings_filters',
'nbval', 'nose-exclude', 'selenium', 'pytest', 'pytest-cov',
'requests-unixsocket'],
'nbval', 'nose-exclude', 'selenium', 'pytest', 'pytest-cov'],
'docs': ['sphinx', 'nbsphinx', 'sphinxcontrib_github_alt'],
'test:sys_platform == "win32"': ['nose-exclude'],
'test:sys_platform != "win32"': ['requests-unixsocket'],
},
python_requires = '>=3.5',
entry_points = {
Expand Down

0 comments on commit 73e6c27

Please sign in to comment.