diff --git a/tests/test_image.py b/tests/test_image.py index d7365f8d49b8ba4ab8d50f81b0b913b7f3e10cb1..34380c802e8d9a476a1b004d660b8a28e06acac7 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -30,6 +30,18 @@ from fsl.utils.tempdir import tempdir from . import make_random_image from . import make_dummy_file +try: + from unittest import mock +except ImportError: + import mock + + +try: + import indexed_gzip as igzip +except ImportError: + igzip = mock.MagicMock() + igzip.ZranError = mock.MagicMock() + def make_image(filename=None, imgtype=1, @@ -116,8 +128,8 @@ def test_load(): shouldRaise = [('notexist', fslpath.PathError), ('notexist.nii.gz', fslpath.PathError), ('ambiguous', fslpath.PathError), - ('notnifti', ImageFileError), - ('notnifti.nii.gz', ImageFileError)] + ('notnifti', (ImageFileError, igzip.ZranError)), + ('notnifti.nii.gz', (ImageFileError, igzip.ZranError))] with tempdir() as testdir: