Skip to content

Commit c13b367

Browse files
committed
ENH: Add test for skeleton update
1 parent ab17865 commit c13b367

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

templateflow/tests/test_conf.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pathlib import Path
2+
from .. import conf, api
3+
4+
5+
def test_update_s3(tmp_path):
6+
conf.TF_HOME = tmp_path / 'templateflow'
7+
conf.TF_HOME.mkdir(exist_ok=True)
8+
9+
# replace TF_SKEL_URL with the path of a legacy skeleton
10+
_skel_url = conf._s3.TF_SKEL_URL
11+
conf._s3.TF_SKEL_URL = (
12+
"https://github.com/templateflow/python-client/raw/0.5.0/"
13+
"templateflow/conf/templateflow-skel.{ext}".format
14+
)
15+
# initialize templateflow home, making sure to pull the legacy skeleton
16+
conf.update(local=False)
17+
# ensure we can grab a file
18+
assert Path(api.get('MNI152NLin2009cAsym', resolution=2, desc='brain', suffix='mask')).exists()
19+
# and ensure we can't fetch one that doesn't yet exist
20+
assert not api.get('Fischer344', hemi='L', desc='brain', suffix='mask')
21+
22+
# refresh the skeleton using the most recent skeleton
23+
conf._s3.TF_SKEL_URL = _skel_url
24+
conf.update(local=True, overwrite=True)
25+
assert Path(api.get('Fischer344', hemi='L', desc='brain', suffix='mask')).exists()

0 commit comments

Comments
 (0)