File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 3
3
"""Tests for the engine module
4
4
"""
5
5
from copy import deepcopy
6
+ from glob import glob
6
7
import os
7
8
from shutil import rmtree
8
9
from tempfile import mkdtemp
@@ -439,3 +440,33 @@ def func2(a):
439
440
yield assert_false , error_raised
440
441
os .chdir (cwd )
441
442
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 )
You can’t perform that action at this time.
0 commit comments