Skip to content

Commit

Permalink
ENH: Add test for skeleton update
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Aug 18, 2020
1 parent ab17865 commit c13b367
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions templateflow/tests/test_conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from pathlib import Path
from .. import conf, api


def test_update_s3(tmp_path):
conf.TF_HOME = tmp_path / 'templateflow'
conf.TF_HOME.mkdir(exist_ok=True)

# replace TF_SKEL_URL with the path of a legacy skeleton
_skel_url = conf._s3.TF_SKEL_URL
conf._s3.TF_SKEL_URL = (
"https://github.com/templateflow/python-client/raw/0.5.0/"
"templateflow/conf/templateflow-skel.{ext}".format
)
# initialize templateflow home, making sure to pull the legacy skeleton
conf.update(local=False)
# ensure we can grab a file
assert Path(api.get('MNI152NLin2009cAsym', resolution=2, desc='brain', suffix='mask')).exists()
# and ensure we can't fetch one that doesn't yet exist
assert not api.get('Fischer344', hemi='L', desc='brain', suffix='mask')

# refresh the skeleton using the most recent skeleton
conf._s3.TF_SKEL_URL = _skel_url
conf.update(local=True, overwrite=True)
assert Path(api.get('Fischer344', hemi='L', desc='brain', suffix='mask')).exists()

0 comments on commit c13b367

Please sign in to comment.