Skip to content

Commit cd985f1

Browse files
committed
TEST: Test Concatenate() in workflow
TraitError occurred in workflow, not when run directly.
1 parent d6be84c commit cd985f1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

nipype/interfaces/freesurfer/tests/test_model.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99

1010
from nipype.testing import assert_equal, skipif
1111
from nipype.interfaces.freesurfer import model, no_freesurfer
12+
import nipype.pipeline.engine as pe
1213

1314

1415
@skipif(no_freesurfer)
1516
def test_concatenate():
1617
tmp_dir = tempfile.mkdtemp()
1718
cwd = os.getcwd()
1819
os.chdir(tmp_dir)
19-
in1 = 'cont1.nii'
20-
in2 = 'cont2.nii'
20+
in1 = os.path.join(tmp_dir, 'cont1.nii')
21+
in2 = os.path.join(tmp_dir, 'cont2.nii')
2122
out = 'bar.nii'
2223

2324
data1 = np.zeros((3, 3, 3, 1), dtype=np.float32)
@@ -40,6 +41,17 @@ def test_concatenate():
4041
os.path.join(tmp_dir, out))
4142
yield (assert_equal, nib.load(out).get_data(), out_data)
4243

44+
# Test in workflow
45+
wf = pe.Workflow('test_concatenate', base_dir=tmp_dir)
46+
concat = pe.Node(model.Concatenate(in_files=[in1, in2],
47+
concatenated_file=out),
48+
name='concat')
49+
wf.add_nodes([concat])
50+
wf.run()
51+
yield (assert_equal, nib.load(os.path.join(tmp_dir, 'test_concatenate',
52+
'concat', out)).get_data(),
53+
out_data)
54+
4355
# Test a simple statistic
4456
res = model.Concatenate(in_files=[in1, in2], concatenated_file=out,
4557
stats='mean').run()

0 commit comments

Comments
 (0)