Skip to content

Commit eb21a65

Browse files
committed
tst: added test for extra json
1 parent 23c2c20 commit eb21a65

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

nipype/pipeline/tests/test_engine.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
assert_false)
1515
import nipype.interfaces.base as nib
1616
import nipype.pipeline.engine as pe
17+
from nipype import logging
1718

1819
class InputSpec(nib.TraitedSpec):
1920
input1 = nib.traits.Int(desc='a random int')
@@ -443,6 +444,8 @@ def func2(a):
443444

444445

445446
def test_mapnode_json():
447+
"""Tests that mapnodes don't generate excess jsons
448+
"""
446449
cwd = os.getcwd()
447450
wd = mkdtemp()
448451
os.chdir(wd)
@@ -462,11 +465,23 @@ def func1(in1):
462465
w1.run()
463466
n1.inputs.in1 = [2]
464467
w1.run()
468+
# should rerun
465469
n1.inputs.in1 = [1]
466470
eg = w1.run()
467471

468472
node = eg.nodes()[0]
469473
outjson = glob(os.path.join(node.output_dir(), '_0x*.json'))
470474
yield assert_equal, len(outjson), 1
475+
476+
# check that multiple json's don't trigger rerun
477+
with open(os.path.join(node.output_dir(), 'test.json'), 'wt') as fp:
478+
fp.write('dummy file')
479+
w1.config['execution'].update(**{'stop_on_first_rerun': True})
480+
error_raised = False
481+
try:
482+
w1.run()
483+
except:
484+
error_raised = True
485+
yield assert_false, error_raised
471486
os.chdir(cwd)
472487
rmtree(wd)

0 commit comments

Comments
 (0)