Skip to content

Commit 8de8b79

Browse files
committed
TEST: Check on_cifs with simulated mount table
1 parent a4dd608 commit 8de8b79

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

nipype/utils/tests/test_filemanip.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from ...utils.filemanip import (save_json, load_json,
1616
fname_presuffix, fnames_presuffix,
1717
hash_rename, check_forhash,
18+
_cifs_table, on_cifs,
1819
copyfile, copyfiles,
1920
filename_to_list, list_to_filename,
2021
check_depends,
@@ -334,3 +335,28 @@ def test_related_files(file, length, expected_files):
334335
for ef in expected_files:
335336
assert ef in related_files
336337

338+
339+
def test_cifs_check():
340+
assert isinstance(_cifs_table, list)
341+
assert isinstance(on_cifs('/'), bool)
342+
fake_table = [('/scratch/tmp', 'ext4'), ('/scratch', 'cifs')]
343+
cifs_targets = [('/scratch/tmp/x/y', False),
344+
('/scratch/tmp/x', False),
345+
('/scratch/x/y', True),
346+
('/scratch/x', True),
347+
('/x/y', False),
348+
('/x', False),
349+
('/', False)]
350+
351+
orig_table = _cifs_table.copy()
352+
_cifs_table.clear()
353+
354+
for target, _ in cifs_targets:
355+
assert on_cifs(target) is False
356+
357+
_cifs_table.extend(fake_table)
358+
for target, expected in cifs_targets:
359+
assert on_cifs(target) is expected
360+
361+
_cifs_table.clear()
362+
_cifs_table.extend(orig_table)

0 commit comments

Comments
 (0)