kopia lustrzana https://github.com/jupyterhub/repo2docker
Merge pull request #1034 from MridulS/hydroshare_break
commit
73ab48a42d
|
@ -110,6 +110,7 @@ jobs:
|
|||
pip freeze
|
||||
# hg-evolve pinned to 9.2 because hg-evolve dropped support for
|
||||
# hg 4.5, installed with apt in Ubuntu 18.04
|
||||
$(hg debuginstall --template "{pythonexe}") -m pip install setuptools --user
|
||||
$(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve==9.2 --user
|
||||
|
||||
- name: "Run tests"
|
||||
|
|
|
@ -67,8 +67,8 @@ class Hydroshare(DoiProvider):
|
|||
conn = self.urlopen(bag_url)
|
||||
total_wait_time = 0
|
||||
while (
|
||||
conn.getcode() == 200
|
||||
and conn.info().get_content_type() != "application/zip"
|
||||
conn.status_code == 200
|
||||
and conn.headers["content-type"] != "application/zip"
|
||||
):
|
||||
wait_time = 10
|
||||
total_wait_time += wait_time
|
||||
|
@ -81,8 +81,8 @@ class Hydroshare(DoiProvider):
|
|||
)
|
||||
time.sleep(wait_time)
|
||||
conn = self.urlopen(bag_url)
|
||||
if conn.getcode() != 200:
|
||||
msg = "Failed to download bag. status code {}.\n".format(conn.getcode())
|
||||
if conn.status_code != 200:
|
||||
msg = "Failed to download bag. status code {}.\n".format(conn.status_code)
|
||||
yield msg
|
||||
raise ContentProviderException(msg)
|
||||
# Bag creation seems to need a small time buffer after it says it's ready.
|
||||
|
|
|
@ -109,25 +109,11 @@ def hydroshare_archive(prefix="b8f6eae9d89241cf8b5904033460af61/data/contents"):
|
|||
yield zfile
|
||||
|
||||
|
||||
class MockInfo:
|
||||
def __init__(self, content_type):
|
||||
self.content_type = content_type
|
||||
|
||||
def get_content_type(self):
|
||||
return self.content_type
|
||||
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, content_type, status_code):
|
||||
self.content_type = content_type
|
||||
self.status_code = status_code
|
||||
self.mock_info = MockInfo(self.content_type)
|
||||
|
||||
def getcode(self):
|
||||
return self.status_code
|
||||
|
||||
def info(self):
|
||||
return self.mock_info
|
||||
self.headers = dict()
|
||||
self.headers["content-type"] = content_type
|
||||
|
||||
|
||||
def test_fetch_bag():
|
||||
|
|
Ładowanie…
Reference in New Issue