|
5 | 5 | import os
|
6 | 6 | from tempfile import mkstemp, mkdtemp
|
7 | 7 |
|
8 |
| -from nipype.testing import assert_equal, assert_true, assert_false |
| 8 | +from nipype.testing import assert_equal, assert_true, assert_false, TempFATFS |
9 | 9 | from nipype.utils.filemanip import (save_json, load_json,
|
10 | 10 | fname_presuffix, fnames_presuffix,
|
11 | 11 | hash_rename, check_forhash,
|
@@ -167,6 +167,27 @@ def test_linkchain():
|
167 | 167 | os.unlink(orig_hdr)
|
168 | 168 |
|
169 | 169 |
|
| 170 | +def test_copyfallback(): |
| 171 | + if os.name is not 'posix': |
| 172 | + return |
| 173 | + orig_img, orig_hdr = _temp_analyze_files() |
| 174 | + pth, imgname = os.path.split(orig_img) |
| 175 | + pth, hdrname = os.path.split(orig_hdr) |
| 176 | + with TempFATFS() as fatdir: |
| 177 | + tgt_img = os.path.join(fatdir, imgname) |
| 178 | + tgt_hdr = os.path.join(fatdir, hdrname) |
| 179 | + for copy in (True, False): |
| 180 | + for use_hardlink in (True, False): |
| 181 | + copyfile(orig_img, tgt_img, copy=copy, |
| 182 | + use_hardlink=use_hardlink) |
| 183 | + yield assert_true, os.path.exists(tgt_img) |
| 184 | + yield assert_true, os.path.exists(tgt_hdr) |
| 185 | + yield assert_false, os.path.islink(tgt_img) |
| 186 | + yield assert_false, os.path.islink(tgt_hdr) |
| 187 | + yield assert_false, os.path.samefile(orig_img, tgt_img) |
| 188 | + yield assert_false, os.path.samefile(orig_hdr, tgt_hdr) |
| 189 | + |
| 190 | + |
170 | 191 | def test_filename_to_list():
|
171 | 192 | x = filename_to_list('foo.nii')
|
172 | 193 | yield assert_equal, x, ['foo.nii']
|
|
0 commit comments