From b95875cb74cea57823176fe9f55e0be262757341 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 12 Jan 2018 11:05:01 +0000
Subject: [PATCH] Unit tests for Image(indexed=True) without indexed_gzip
 installed

---
 tests/test_image_advanced.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/test_image_advanced.py b/tests/test_image_advanced.py
index a8401b92d..a05f5d521 100644
--- a/tests/test_image_advanced.py
+++ b/tests/test_image_advanced.py
@@ -8,6 +8,8 @@
 import os.path as op
 import            time
 
+import mock
+
 import numpy   as np
 import nibabel as nib
 
@@ -15,6 +17,19 @@ import tests
 import fsl.data.image as fslimage
 
 
+from . import make_random_image
+
+
+# make sure Image(indexed=True) works
+# even if indexed_gzip is not present
+def test_image_indexed_no_igzip_threaded():
+    with mock.patch.dict('sys.modules', indexed_gzip=None):
+        _test_image_indexed(True)
+
+def test_image_indexed_no_igzip_unthreaded():
+    with mock.patch.dict('sys.modules', indexed_gzip=None):
+        _test_image_indexed(False)
+
 def test_image_indexed_threaded(  ): _test_image_indexed(True)
 def test_image_indexed_unthreaded(): _test_image_indexed(False)
 def _test_image_indexed(threaded):
@@ -24,7 +39,7 @@ def _test_image_indexed(threaded):
         filename = op.join(testdir, 'image.nii.gz')
 
         # Data range grows with volume
-        data  = np.zeros((100, 100, 100, 50))
+        data  = np.zeros((50, 50, 50, 50))
         for vol in range(data.shape[-1]):
             data[..., vol] = vol
 
-- 
GitLab