Skip to content
Snippets Groups Projects
Commit eeb2580c authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Test createFSLWrapper rename capability

parent 5ab211b1
No related branches found
No related tags found
1 merge request!47ENH: New option in createFSLWrapper to generate wrapper script with different name to executable
......@@ -305,6 +305,46 @@ def test_create_wrappers_no_handle_gui_wrappers():
assert not op.exists(wrapper)
def test_create_wrappers_rename():
"""Tests the renaming functionality in createFSLWrapper. If
$FSLDIR/bin/script exists, a wrapper with a different name
(e.g. $FSLDIR/share/fsl/bin/renamed_script) can be created by passing
"script=renamed_script".
"""
# Keys are passed to createFSLWrapper, values
# are wrappers that should be created
scripts = {
'script1=renamed_script1' : 'renamed_script1',
'script2=renamed_script2' : 'renamed_script2',
'script3_gui=renamed_script3_gui' : 'renamed_script3_gui',
'script4_gui=renamed_script4' : 'renamed_script4'
}
with temp_fsldir() as (fsldir, wrapperdir):
for script in scripts.keys():
target = script.split('=')[0]
with open(target, 'wt') as f:
touch(op.join(fsldir, 'bin', target))
for wrappers in it.permutations(scripts.keys()):
args = ' '.join(wrappers)
run(f'{CREATE_WRAPPER} {args}')
for arg in wrappers:
target = arg.split('=')[0]
wrapper = op.join(wrapperdir, scripts[arg])
assert op.exists(wrapper)
assert get_called_command(wrapper) == target
run(f'{REMOVE_WRAPPER} {args}')
for arg in wrappers:
target = scripts[arg]
wrapper = op.join(wrapperdir, target)
assert not op.exists(wrapper)
if __name__ == '__main__':
# base dir can be speecified on command line
if len(sys.argv) > 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment