|
15 | 15 | from ...utils.filemanip import (save_json, load_json,
|
16 | 16 | fname_presuffix, fnames_presuffix,
|
17 | 17 | hash_rename, check_forhash,
|
| 18 | + _cifs_table, on_cifs, |
18 | 19 | copyfile, copyfiles,
|
19 | 20 | filename_to_list, list_to_filename,
|
20 | 21 | check_depends,
|
@@ -334,3 +335,28 @@ def test_related_files(file, length, expected_files):
|
334 | 335 | for ef in expected_files:
|
335 | 336 | assert ef in related_files
|
336 | 337 |
|
| 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