|
11 | 11 | import warnings
|
12 | 12 |
|
13 | 13 | import pytest
|
| 14 | +from ... import config |
14 | 15 | from ...testing import TempFATFS
|
15 | 16 | from ...utils.filemanip import (save_json, load_json,
|
16 | 17 | fname_presuffix, fnames_presuffix,
|
@@ -232,6 +233,29 @@ def test_copyfallback(_temp_analyze_files):
|
232 | 233 | os.unlink(tgt_hdr)
|
233 | 234 |
|
234 | 235 |
|
| 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 | + |
235 | 259 | def test_get_related_files(_temp_analyze_files):
|
236 | 260 | orig_img, orig_hdr = _temp_analyze_files
|
237 | 261 |
|
|
0 commit comments