Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions phys2bids/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import ssl
from urllib.request import urlretrieve

import pytest
import requests


def pytest_addoption(parser):
Expand Down Expand Up @@ -50,7 +50,11 @@ def fetch_file(osf_id, path, filename):
url = "https://osf.io/{}/download".format(osf_id)
full_path = os.path.join(path, filename)
if not os.path.isfile(full_path):
urlretrieve(url, full_path)
req = requests.get(url, allow_redirects=True)
req.raise_for_status()
with open(full_path, "wb") as f:
f.write(req.content)
f.close()
return full_path


Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ test =
pytest >=5.3
pytest-cov
coverage
requests
%(interfaces)s
%(style)s
all =
Expand Down