Skip to content

Commit 3e4da11

Browse files
committed
skip tests if scipy not available
1 parent 0d8843b commit 3e4da11

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

nibabel/cmdline/tests/test_conform.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@
88
#
99
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
1010

11+
import unittest
12+
1113
import pytest
1214

1315
import nibabel as nib
1416
from nibabel.testing import test_data
1517
from nibabel.cmdline.conform import main
18+
from nibabel.optpkg import optional_package
19+
20+
_, have_scipy, _ = optional_package('scipy.ndimage')
21+
needs_scipy = unittest.skipUnless(have_scipy, 'These tests need scipy')
1622

1723

24+
@needs_scipy
1825
def test_default(tmpdir):
1926
infile = test_data(fname="anatomical.nii")
2027
outfile = tmpdir / "output.nii.gz"
@@ -26,6 +33,7 @@ def test_default(tmpdir):
2633
assert nib.orientations.aff2axcodes(c.affine) == ('R', 'A', 'S')
2734

2835

36+
@needs_scipy
2937
def test_nondefault(tmpdir):
3038
infile = test_data(fname="anatomical.nii")
3139
outfile = tmpdir / "output.nii.gz"
@@ -42,6 +50,7 @@ def test_nondefault(tmpdir):
4250
assert nib.orientations.aff2axcodes(c.affine) == tuple(orientation)
4351

4452

53+
@needs_scipy
4554
def test_non3d(tmpdir):
4655
infile = test_data(fname="functional.nii")
4756
outfile = tmpdir / "output.nii.gz"

0 commit comments

Comments
 (0)