Skip to content

Commit d7fdb6f

Browse files
committed
fix: mapnode debug error - closes #1690
1 parent 5e0597b commit d7fdb6f

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

nipype/pipeline/engine/nodes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,6 @@ def _node_runner(self, nodes, updatehash=False):
11291129
node.run(updatehash=updatehash)
11301130
except Exception as err:
11311131
if str2bool(self.config['execution']['stop_on_first_crash']):
1132-
self._result = node.result
11331132
raise
11341133
finally:
11351134
yield i, node, err

nipype/pipeline/engine/tests/test_utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ def test_multi_disconnected_iterable():
333333
yield assert_equal, len(eg.nodes()), 60
334334
rmtree(out_dir)
335335

336+
336337
def test_provenance():
337338
out_dir = mkdtemp()
338339
metawf = pe.Workflow(name='meta')
@@ -345,3 +346,28 @@ def test_provenance():
345346
yield assert_equal, len(psg.bundles), 2
346347
yield assert_equal, len(psg.get_records()), 7
347348
rmtree(out_dir)
349+
350+
351+
def test_mapnode_crash():
352+
def myfunction(string):
353+
return string + 'meh'
354+
node = pe.MapNode(niu.Function(input_names=['WRONG'],
355+
output_names=['newstring'],
356+
function=myfunction),
357+
iterfield=['WRONG'],
358+
name='myfunc')
359+
360+
node.inputs.WRONG = ['string' + str(i) for i in range(3)]
361+
node.config = deepcopy(config._sections)
362+
node.config['execution']['stop_on_first_crash'] = True
363+
cwd = os.getcwd()
364+
node.base_dir = mkdtemp()
365+
366+
error_raised = False
367+
try:
368+
node.run()
369+
except TypeError as e:
370+
error_raised = True
371+
os.chdir(cwd)
372+
rmtree(node.base_dir)
373+
yield assert_true, error_raised

0 commit comments

Comments
 (0)