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