@@ -338,40 +338,41 @@ def test_provenance(tmpdir):
338
338
assert len (psg .bundles ) == 2
339
339
assert len (psg .get_records ()) == 7
340
340
341
-
342
341
def test_mapnode_crash (tmpdir ):
343
342
"""Test mapnode crash when stop_on_first_crash is True"""
343
+ cwd = os .getcwd ()
344
344
def myfunction (string ):
345
345
return string + 'meh'
346
346
node = pe .MapNode (niu .Function (input_names = ['WRONG' ],
347
347
output_names = ['newstring' ],
348
348
function = myfunction ),
349
349
iterfield = ['WRONG' ],
350
350
name = 'myfunc' )
351
-
352
351
node .inputs .WRONG = ['string' + str (i ) for i in range (3 )]
353
352
node .config = deepcopy (config ._sections )
354
353
node .config ['execution' ]['stop_on_first_crash' ] = True
355
354
node .base_dir = str (tmpdir )
356
355
with pytest .raises (TypeError ):
357
356
node .run ()
358
-
357
+ os . chdir ( cwd )
359
358
360
359
def test_mapnode_crash2 (tmpdir ):
361
360
"""Test mapnode crash when stop_on_first_crash is False"""
361
+ cwd = os .getcwd ()
362
362
def myfunction (string ):
363
363
return string + 'meh'
364
+
364
365
node = pe .MapNode (niu .Function (input_names = ['WRONG' ],
365
366
output_names = ['newstring' ],
366
367
function = myfunction ),
367
368
iterfield = ['WRONG' ],
368
369
name = 'myfunc' )
369
-
370
370
node .inputs .WRONG = ['string' + str (i ) for i in range (3 )]
371
371
node .base_dir = str (tmpdir )
372
372
373
373
with pytest .raises (Exception ):
374
374
node .run ()
375
+ os .chdir (cwd )
375
376
376
377
377
378
def test_mapnode_crash3 (tmpdir ):
@@ -384,7 +385,6 @@ def myfunction(string):
384
385
function = myfunction ),
385
386
iterfield = ['WRONG' ],
386
387
name = 'myfunc' )
387
-
388
388
node .inputs .WRONG = ['string' + str (i ) for i in range (3 )]
389
389
wf = pe .Workflow ('testmapnodecrash' )
390
390
wf .add_nodes ([node ])
0 commit comments