Commit 4c777562 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

TEST: Test cmdonly handling

parent 1a2577d7
......@@ -179,6 +179,13 @@ def test_run_passthrough():
assert run.run('./script.sh', env=env) == expstdout
def test_cmdonly():
assert run.run('script.sh', cmdonly=True) == ['script.sh']
assert run.run('script.sh 1 2 3', cmdonly=True) == ['script.sh', '1', '2', '3']
assert run.run(['script.sh'], cmdonly=True) == ['script.sh']
assert run.run(['script.sh', '1'], cmdonly=True) == ['script.sh', '1']
def test_dryrun():
test_script = textwrap.dedent("""
......
......@@ -753,15 +753,20 @@ def test_cmdwrapper():
with run.dryrun():
assert func(1, 2)[0] == 'func 1 2'
assert func(1, 2, cmdonly=True) == ['func', '1', '2']
def test_fslwrapper():
@wutils.fslwrapper
def func(a, b):
return ['func', str(a), str(b)]
with run.dryrun(), mockFSLDIR(bin=('func',)) as fsldir:
with mockFSLDIR(bin=('func',)) as fsldir:
expected = '{} 1 2'.format(op.join(fsldir, 'bin', 'func'))
assert func(1, 2)[0] == expected
with run.dryrun():
assert func(1, 2)[0] == expected
func(1, 2, cmdonly=True)[0] == list(shlex.split(expected))
_test_script = textwrap.dedent("""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment