Skip to content

Commit 4861f6f

Browse files
committed
BF - skip read/write test for SPM images when no scipy
1 parent 1ab2e1c commit 4861f6f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

nibabel/tests/test_spm99analyze.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010

1111
import numpy as np
1212

13-
from numpy.testing import assert_array_equal, assert_array_almost_equal
13+
from numpy.testing import assert_array_equal, assert_array_almost_equal, dec
14+
15+
# Decorator to skip tests requiring save / load if scipy not available for mat
16+
# files
17+
try:
18+
import scipy
19+
except ImportError:
20+
have_scipy = False
21+
else:
22+
have_scipy = True
23+
scipy_skip = dec.skipif(not have_scipy, 'scipy not available')
1424

1525
from ..spm99analyze import Spm99AnalyzeHeader, \
1626
Spm99AnalyzeImage, HeaderTypeError
@@ -92,6 +102,11 @@ class TestSpm99AnalyzeImage(test_analyze.TestAnalyzeImage):
92102
# class for testing images
93103
image_class = Spm99AnalyzeImage
94104

105+
# Decorating the old way, before the team invented @
106+
test_data_hdr_cache = (scipy_skip(
107+
test_analyze.TestAnalyzeImage.test_data_hdr_cache
108+
))
109+
95110

96111
@parametric
97112
def test_origin_affine():

0 commit comments

Comments
 (0)