Skip to content

Commit 80d3f05

Browse files
authored
Merge pull request #2349 from djarecka/FSSourceInputSpec
small changes in FSSourceInputSpec (fixes #2116)
2 parents 045b28e + c730bfe commit 80d3f05

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

nipype/interfaces/io.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -1555,16 +1555,12 @@ def _list_outputs(self):
15551555

15561556

15571557
class FSSourceInputSpec(BaseInterfaceInputSpec):
1558-
subjects_dir = Directory(
1559-
mandatory=True, desc='Freesurfer subjects directory.')
1560-
subject_id = Str(
1561-
mandatory=True, desc='Subject name for whom to retrieve data')
1562-
hemi = traits.Enum(
1563-
'both',
1564-
'lh',
1565-
'rh',
1566-
usedefault=True,
1567-
desc='Selects hemisphere specific outputs')
1558+
subjects_dir = Directory(exists=True, mandatory=True,
1559+
desc='Freesurfer subjects directory.')
1560+
subject_id = Str(mandatory=True,
1561+
desc='Subject name for whom to retrieve data')
1562+
hemi = traits.Enum('both', 'lh', 'rh', usedefault=True,
1563+
desc='Selects hemisphere specific outputs')
15681564

15691565

15701566
class FSSourceOutputSpec(TraitedSpec):

nipype/interfaces/tests/test_io.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import pytest
1717
import nipype
1818
import nipype.interfaces.io as nio
19-
from nipype.interfaces.base import Undefined
19+
from nipype.interfaces.base import Undefined, TraitError
2020

2121
# Check for boto
2222
noboto = False
@@ -498,6 +498,12 @@ def test_freesurfersource():
498498
assert fss.inputs.subjects_dir == Undefined
499499

500500

501+
def test_freesurfersource_incorrectdir():
502+
fss = nio.FreeSurferSource()
503+
with pytest.raises(TraitError) as err:
504+
fss.inputs.subjects_dir = 'path/to/no/existing/directory'
505+
506+
501507
def test_jsonsink_input():
502508

503509
ds = nio.JSONFileSink()

0 commit comments

Comments
 (0)