From 5586a4997ac295af6e85f7b70fab0c8bf3bb0094 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 4 Nov 2017 03:07:42 +0000 Subject: [PATCH] BF: allow for generic IOError-based exception to be thrown when loading non existing file Gbp-Pq: Name changeset_751531a2894e69383f75e6a9b97586e74759ab1b.diff --- nipy/io/tests/test_image_io.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nipy/io/tests/test_image_io.py b/nipy/io/tests/test_image_io.py index 3bc1549..fa8e2c6 100644 --- a/nipy/io/tests/test_image_io.py +++ b/nipy/io/tests/test_image_io.py @@ -41,7 +41,10 @@ def load_template_img(): def test_badfile(): filename = "bad_file.foo" - assert_raises(ImageFileError, load_image, filename) + # nibabel prior 2.1.0 was throwing ImageFileError and then more specific + # FileNotFileNotFoundError which should be a subclass of IOError. + # To not mess with version specific imports, checking for IOError + assert_raises((ImageFileError, IOError), load_image, filename) @if_templates -- 2.30.2