- Notifications
You must be signed in to change notification settings - Fork 536
[FIX] immunize shutil.rmtree to node non-existence for remove_node_di… #3148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c451b69 b6474db a6f03b5 94000dd b473b6b File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -3,10 +3,11 @@ | |
| # vi: set ft=python sts=4 ts=4 sw=4 et: | ||
| """Tests for the engine module | ||
| """ | ||
| import pytest | ||
| from pathlib import Path | ||
| import numpy as np | ||
| import scipy.sparse as ssp | ||
| | ||
| | ||
| def test_scipy_sparse(): | ||
| foo = ssp.lil_matrix(np.eye(3, k=1)) | ||
| goo = foo.getrowview(0) | ||
| | @@ -39,3 +40,34 @@ def func(arg1): | |
| | ||
| wf.run(plugin='MultiProc') | ||
| """ | ||
| | ||
| @pytest.mark.regression | ||
| def test_remove_nodes(tmpdir): | ||
| import os | ||
| import nipype.interfaces.utility as niu | ||
| import nipype.pipeline.engine as pe | ||
| | ||
| wf = pe.Workflow(name='test') | ||
| | ||
| def func(arg1): | ||
| try: | ||
| if arg1 == 2: | ||
| raise Exception('arg cannot be ' + str(arg1)) | ||
| except: | ||
| pass | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the goal to fail or not? If not, we can skip the entire | ||
| return arg1 | ||
| | ||
| funkynode = pe.MapNode(niu.Function(function=func, input_names=['arg1'], | ||
| output_names=['out']), | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant: funkynode = pe.MapNode(niu.Function(function=func),Also, is there something intrinsic about the problem and | ||
| iterfield=['arg1'], | ||
| name = 'functor') | ||
| funkynode.inputs.arg1 = [1,2] | ||
| | ||
| wf.add_nodes([funkynode]) | ||
| wf.base_dir = tmpdir | ||
| wf.config['execution']['remove_node_directories'] = 'true' | ||
| wf.config['execution']['stop_on_first_crash'] = 'false' | ||
| wf.config['logging']['crashdump_dir'] = tmpdir | ||
dPys marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| res = wf.run(plugin='MultiProc') | ||
| | ||
| assert os.path.isdir(Path(tmpdir)/'test/functor') is False | ||
dPys marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
Uh oh!
There was an error while loading. Please reload this page.