diff --git a/tests/test_run.py b/tests/test_run.py index 363d4489ec30d25799e152f23e96becf12f06ab9..7308b849c72f6f82afd00eb417c4d479b58d0f30 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -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(""" diff --git a/tests/test_wrappers/test_wrapperutils.py b/tests/test_wrappers/test_wrapperutils.py index e928057ff858a37b030f149782cf33400fe54e02..d19e3ed13374217fb4d7e393ee5d87ccb5327802 100644 --- a/tests/test_wrappers/test_wrapperutils.py +++ b/tests/test_wrappers/test_wrapperutils.py @@ -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("""