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

TEST: Test creating multiple wrappers for one command

parent a59c0504
No related branches found
No related tags found
1 merge request!48Mnt/wrapper comments
Pipeline #12540 passed
......@@ -345,6 +345,46 @@ def test_create_wrappers_rename():
assert not op.exists(wrapper)
def test_create_wrappers_multiple_same():
"""Tests creating multiple wrapper scripts which call the same
target command.
"""
# Keys are passed to createFSLWrapper, values
# are wrappers that should be created
scripts = {
'scripta' : 'scripta',
'scripta=script1' : 'script1',
'scripta=script2' : 'script2',
'scriptb' : 'scriptb',
'scriptc=script3' : 'script3',
'scriptc=script4' : '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