diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index fc36170369..6bb9a943f0 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1555,16 +1555,12 @@ def _list_outputs(self): class FSSourceInputSpec(BaseInterfaceInputSpec): - subjects_dir = Directory( - mandatory=True, desc='Freesurfer subjects directory.') - subject_id = Str( - mandatory=True, desc='Subject name for whom to retrieve data') - hemi = traits.Enum( - 'both', - 'lh', - 'rh', - usedefault=True, - desc='Selects hemisphere specific outputs') + subjects_dir = Directory(exists=True, mandatory=True, + desc='Freesurfer subjects directory.') + subject_id = Str(mandatory=True, + desc='Subject name for whom to retrieve data') + hemi = traits.Enum('both', 'lh', 'rh', usedefault=True, + desc='Selects hemisphere specific outputs') class FSSourceOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index a2103eadf2..76fc9e2577 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -16,7 +16,7 @@ import pytest import nipype import nipype.interfaces.io as nio -from nipype.interfaces.base import Undefined +from nipype.interfaces.base import Undefined, TraitError # Check for boto noboto = False @@ -498,6 +498,12 @@ def test_freesurfersource(): assert fss.inputs.subjects_dir == Undefined +def test_freesurfersource_incorrectdir(): + fss = nio.FreeSurferSource() + with pytest.raises(TraitError) as err: + fss.inputs.subjects_dir = 'path/to/no/existing/directory' + + def test_jsonsink_input(): ds = nio.JSONFileSink()