Skip to content

Commit 67606fd

Browse files
committed
Don't fail tests if pycurl is not installed
1 parent 3703273 commit 67606fd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

binderhub/tests/utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77

88
import requests
99
from tornado import gen
10-
from tornado.curl_httpclient import CurlAsyncHTTPClient
1110
from tornado.httpclient import HTTPError, HTTPRequest, HTTPResponse
1211
from tornado.httputil import HTTPHeaders
1312

13+
try:
14+
from tornado.curl_httpclient import CurlAsyncHTTPClient
1415

15-
class MockAsyncHTTPClient(CurlAsyncHTTPClient):
16+
BASE_HTTP_CLIENT = CurlAsyncHTTPClient
17+
except ModuleNotFoundError:
18+
# pycurl is not installed, use regular asynchttpclient
19+
from tornado.httpclient import AsyncHTTPClient
20+
21+
BASE_HTTP_CLIENT = AsyncHTTPClient
22+
23+
24+
class MockAsyncHTTPClient(BASE_HTTP_CLIENT):
1625
mocks = {}
1726
records = {}
1827

0 commit comments

Comments
 (0)