|
6 | 6 | import warnings
|
7 | 7 | from pathlib import Path
|
8 | 8 |
|
9 |
| -import mock |
| 9 | +from unittest import mock, SkipTest |
10 | 10 | import pytest
|
11 | 11 | from ...testing import TempFATFS
|
12 | 12 | from ...utils.filemanip import (
|
@@ -238,22 +238,22 @@ def test_copyfallback(_temp_analyze_files):
|
238 | 238 | try:
|
239 | 239 | fatfs = TempFATFS()
|
240 | 240 | except (IOError, OSError):
|
241 |
| - warnings.warn("Fuse mount failed. copyfile fallback tests skipped.") |
242 |
| - else: |
243 |
| - with fatfs as fatdir: |
244 |
| - tgt_img = os.path.join(fatdir, imgname) |
245 |
| - tgt_hdr = os.path.join(fatdir, hdrname) |
246 |
| - for copy in (True, False): |
247 |
| - for use_hardlink in (True, False): |
248 |
| - copyfile(orig_img, tgt_img, copy=copy, use_hardlink=use_hardlink) |
249 |
| - assert os.path.exists(tgt_img) |
250 |
| - assert os.path.exists(tgt_hdr) |
251 |
| - assert not os.path.islink(tgt_img) |
252 |
| - assert not os.path.islink(tgt_hdr) |
253 |
| - assert not os.path.samefile(orig_img, tgt_img) |
254 |
| - assert not os.path.samefile(orig_hdr, tgt_hdr) |
255 |
| - os.unlink(tgt_img) |
256 |
| - os.unlink(tgt_hdr) |
| 241 | + raise SkipTest("Fuse mount failed. copyfile fallback tests skipped.") |
| 242 | + |
| 243 | + with fatfs as fatdir: |
| 244 | + tgt_img = os.path.join(fatdir, imgname) |
| 245 | + tgt_hdr = os.path.join(fatdir, hdrname) |
| 246 | + for copy in (True, False): |
| 247 | + for use_hardlink in (True, False): |
| 248 | + copyfile(orig_img, tgt_img, copy=copy, use_hardlink=use_hardlink) |
| 249 | + assert os.path.exists(tgt_img) |
| 250 | + assert os.path.exists(tgt_hdr) |
| 251 | + assert not os.path.islink(tgt_img) |
| 252 | + assert not os.path.islink(tgt_hdr) |
| 253 | + assert not os.path.samefile(orig_img, tgt_img) |
| 254 | + assert not os.path.samefile(orig_hdr, tgt_hdr) |
| 255 | + os.unlink(tgt_img) |
| 256 | + os.unlink(tgt_hdr) |
257 | 257 |
|
258 | 258 |
|
259 | 259 | def test_get_related_files(_temp_analyze_files):
|
@@ -295,7 +295,7 @@ def test_ensure_list(filename, expected):
|
295 | 295 |
|
296 | 296 |
|
297 | 297 | @pytest.mark.parametrize(
|
298 |
| - "list, expected", [(["foo.nii"], "foo.nii"), (["foo", "bar"], ["foo", "bar"]),] |
| 298 | + "list, expected", [(["foo.nii"], "foo.nii"), (["foo", "bar"], ["foo", "bar"])] |
299 | 299 | )
|
300 | 300 | def test_simplify_list(list, expected):
|
301 | 301 | x = simplify_list(list)
|
|
0 commit comments