Skip to content

Commit 487e0e5

Browse files
authored
Merge pull request #1392 from yuvipanda/no-urlopen
2 parents b7c1515 + 0305dab commit 487e0e5

File tree

3 files changed

+0
-19
lines changed

3 files changed

+0
-19
lines changed

repo2docker/contentproviders/doi.py

-13
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ def _request(self, url, **kwargs):
2929

3030
urlopen = _request
3131

32-
def _urlopen(self, req, headers=None):
33-
"""A urlopen() helper"""
34-
# someone passed a string, not a request
35-
if not isinstance(req, request.Request):
36-
req = request.Request(req)
37-
38-
req.add_header("User-Agent", f"repo2docker {__version__}")
39-
if headers is not None:
40-
for key, value in headers.items():
41-
req.add_header(key, value)
42-
43-
return request.urlopen(req)
44-
4532
def doi2url(self, doi):
4633
# Transform a DOI to a URL
4734
# If not a doi, assume we have a URL and return

tests/unit/contentproviders/test_figshare.py

-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def test_fetch_zip(requests_mock):
129129
)
130130
requests_mock.get(f"file://{fig_path}", content=open(fig_path, "rb").read())
131131

132-
# with patch.object(Figshare, "urlopen", new=mock_urlopen):
133132
with TemporaryDirectory() as d:
134133
output = []
135134
for l in test_fig.fetch(test_spec, d):

tests/unit/contentproviders/test_swhid.py

-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ def test_detect(swhid, expected):
5656
assert provider.detect(swhid) == expected
5757

5858

59-
def fake_urlopen(req):
60-
print(req)
61-
return req.headers
62-
63-
6459
def test_unresolving_swhid():
6560
provider = Swhid()
6661

0 commit comments

Comments
 (0)