Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def _parameterization_dir(self, param):
- Otherwise, return the parameterization unchanged.
"""
if len(param) > 32:
return sha1(param).hexdigest()
return sha1(param.encode()).hexdigest()
else:
return param

Expand Down
34 changes: 33 additions & 1 deletion nipype/pipeline/engine/tests/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class InputSpec(nib.TraitedSpec):
input1 = nib.traits.Int(desc='a random int')
input2 = nib.traits.Int(desc='a random int')

input_file = nib.traits.File(desc='Random File')

class OutputSpec(nib.TraitedSpec):
output1 = nib.traits.List(nib.traits.Int, desc='outputs')
Expand Down Expand Up @@ -626,6 +626,38 @@ def func1(in1):
assert not error_raised


def test_parameterize_dirs_false(tmpdir):
from .... import config
from ....interfaces.utility import IdentityInterface
from ....testing import example_data

config.update_config({'execution': {'parameterize_dirs': False}})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a local change rather than a global change.


wd = str(tmpdir)
os.chdir(wd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two statements are not required for a workflow since you set wf.base_dir = wd later.


input_file = example_data('fsl_motion_outliers_fd.txt')

n1 = pe.Node(EngineTestInterface(), name="Node1")
n1.iterables = ('input_file', (input_file, input_file))
n1.interface.inputs.input1 = 1

n2 = pe.Node(IdentityInterface(fields='in1'), name="Node2")

wf = pe.Workflow(name="Test")
wf.base_dir = wd
wf.connect([(n1, n2, [('output1', 'in1')])])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local change for wf: wf.config['execution']['parameterize_dirs'] = False


error_raised = False
try:
wf.run()
except TypeError as typerr:
from nipype.pipeline.engine.base import logger
logger.info('Exception: %s' % str(typerr))
error_raised = True
assert not error_raised


def test_serial_input(tmpdir):
wd = str(tmpdir)
os.chdir(wd)
Expand Down