Skip to content

Commit 9b47887

Browse files
committed
TEST: Condition freesurfer test on command installation
1 parent b34aab2 commit 9b47887

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

nipype/interfaces/freesurfer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# vi: set ft=python sts=4 ts=4 sw=4 et:
33
"""Top-level namespace for freesurfer."""
44

5-
from .base import Info, FSCommand
5+
from .base import Info, FSCommand, no_freesurfer
66
from .preprocess import (ParseDICOMDir, UnpackSDICOMDir, MRIConvert, Resample,
77
ReconAll, BBRegister, ApplyVolTransform, Smooth,
88
DICOMConvert, RobustRegister, FitMSParams,

nipype/interfaces/freesurfer/base.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ def _subjects_dir_update(self):
117117
def set_default_subjects_dir(cls, subjects_dir):
118118
cls._subjects_dir = subjects_dir
119119

120-
@property
121-
def version(self):
122-
return Info.version()
123-
124120
def run(self, **inputs):
125121
if 'subjects_dir' in inputs:
126122
self.inputs.subjects_dir = inputs['subjects_dir']
@@ -220,3 +216,14 @@ def run(self, **inputs):
220216
self.inputs.num_threads = inputs['num_threads']
221217
self._num_threads_update()
222218
return super(FSCommandOpenMP, self).run(**inputs)
219+
220+
221+
def no_freesurfer():
222+
"""Checks if FreeSurfer is NOT installed
223+
used with skipif to skip tests that will
224+
fail if FreeSurfer is not installed"""
225+
226+
if Info.version() is None:
227+
return True
228+
else:
229+
return False

nipype/interfaces/freesurfer/tests/test_model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
import numpy as np
88
import nibabel as nib
99

10-
from nipype.testing import assert_equal
11-
from nipype.interfaces.freesurfer import model
10+
from nipype.testing import assert_equal, skipif
11+
from nipype.interfaces.freesurfer import model, no_freesurfer
1212

1313

14+
@skipif(no_freesurfer)
1415
def test_concatenate():
1516
tmp_dir = tempfile.mkdtemp()
1617
cwd = os.getcwd()

0 commit comments

Comments
 (0)