Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cbf2661

Browse files
committed
TEST: Check links disabled with config option
1 parent d0a7792 commit cbf2661

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎nipype/utils/tests/test_filemanip.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import warnings
1212

1313
import pytest
14+
from ... import config
1415
from ...testing import TempFATFS
1516
from ...utils.filemanip import (save_json, load_json,
1617
fname_presuffix, fnames_presuffix,
@@ -232,6 +233,29 @@ def test_copyfallback(_temp_analyze_files):
232233
os.unlink(tgt_hdr)
233234

234235

236+
def test_symlink_disable(_temp_analyze_files):
237+
tmp = config.getboolean('execution', 'disable_symbolic_links')
238+
assert isinstance(tmp, bool)
239+
config.set('execution', 'disable_symbolic_links', True)
240+
orig_img, orig_hdr = _temp_analyze_files
241+
pth, imgname = os.path.split(orig_img)
242+
pth, hdrname = os.path.split(orig_hdr)
243+
new_img = os.path.join(pth, 'newfile.img')
244+
new_hdr = os.path.join(pth, 'newfile.hdr')
245+
for copy in (True, False):
246+
copyfile(orig_img, new_img, copy=copy, use_hardlink=False)
247+
assert os.path.exists(new_img)
248+
assert os.path.exists(new_hdr)
249+
assert not os.path.islink(new_img)
250+
assert not os.path.islink(new_hdr)
251+
assert not os.path.samefile(orig_img, new_img)
252+
assert not os.path.samefile(orig_hdr, new_hdr)
253+
os.unlink(new_img)
254+
os.unlink(new_hdr)
255+
256+
config.set('execution', 'disable_symbolic_links', tmp)
257+
258+
235259
def test_get_related_files(_temp_analyze_files):
236260
orig_img, orig_hdr = _temp_analyze_files
237261

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /