Skip to content

Commit 8edb186

Browse files
committed
BF: fix file error on Windows
Windows was failing when FileNotFoundError raises (because it was expecting an IOError).
1 parent d49e829 commit 8edb186

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

nipy/io/tests/test_image_io.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ def load_template_img():
4141

4242
def test_badfile():
4343
filename = "bad_file.foo"
44-
# nibabel prior 2.1.0 was throwing ImageFileError and then more specific
45-
# FileNotFileNotFoundError which should be a subclass of IOError.
46-
# To not mess with version specific imports, checking for IOError
47-
assert_raises((ImageFileError, IOError), load_image, filename)
44+
# nibabel prior 2.1.0 was throwing a ImageFileError for the not-recognized
45+
# file type. >=2.1.0 give a FileNotFoundError.
46+
try:
47+
from nibabel.py3k import FileNotFoundError
48+
except ImportError:
49+
FileNotFoundError = IOError
50+
assert_raises((ImageFileError, FileNotFoundError), load_image, filename)
4851

4952

5053
@if_templates

0 commit comments

Comments
 (0)