Skip to content

Commit 23c2c20

Browse files
committed
tst: added test for mapnode multiple json failure
1 parent 8454452 commit 23c2c20

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

nipype/pipeline/tests/test_engine.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Tests for the engine module
44
"""
55
from copy import deepcopy
6+
from glob import glob
67
import os
78
from shutil import rmtree
89
from tempfile import mkdtemp
@@ -439,3 +440,33 @@ def func2(a):
439440
yield assert_false, error_raised
440441
os.chdir(cwd)
441442
rmtree(wd)
443+
444+
445+
def test_mapnode_json():
446+
cwd = os.getcwd()
447+
wd = mkdtemp()
448+
os.chdir(wd)
449+
from nipype import MapNode, Function, Workflow
450+
def func1(in1):
451+
return in1 + 1
452+
n1 = MapNode(Function(input_names=['in1'],
453+
output_names=['out'],
454+
function=func1),
455+
iterfield=['in1'],
456+
name='n1')
457+
n1.inputs.in1 = [1]
458+
w1 = Workflow(name='test')
459+
w1.base_dir = wd
460+
w1.config = {'crashdump_dir': wd}
461+
w1.add_nodes([n1])
462+
w1.run()
463+
n1.inputs.in1 = [2]
464+
w1.run()
465+
n1.inputs.in1 = [1]
466+
eg = w1.run()
467+
468+
node = eg.nodes()[0]
469+
outjson = glob(os.path.join(node.output_dir(), '_0x*.json'))
470+
yield assert_equal, len(outjson), 1
471+
os.chdir(cwd)
472+
rmtree(wd)

0 commit comments

Comments
 (0)