From 73e55b58d7f68a5603d04bb2362ea77585f43dc4 Mon Sep 17 00:00:00 2001 From: Martin Craig <martin.craig@eng.ox.ac.uk> Date: Thu, 18 Oct 2018 15:44:18 +0100 Subject: [PATCH] Updated logcmd test for new interpretation of this parameter It is now a stream in its own right rather than a boolean --- tests/test_run.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_run.py b/tests/test_run.py index bc77a46fd..422222fb9 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -353,20 +353,22 @@ def test_run_logcmd(): exit 0 """).strip() - expstdout = './script.sh 1 2 3\noutput 1 2 3\n' + expcmd = './script.sh 1 2 3\n' + expstdout = 'output 1 2 3\n' with tempdir.tempdir(): mkexec('script.sh', test_script) - stdout = run.run('./script.sh 1 2 3', log={'cmd' : True}) - assert stdout == expstdout - mkexec('script.sh', test_script) - stdout = run.run('./script.sh 1 2 3', log={'cmd' : True}) - assert stdout == expstdout + with open('my_stdout', 'wt') as stdoutf: + stdout = run.run('./script.sh 1 2 3', + log={'cmd' : stdoutf}) + + assert stdout == expstdout + assert open('my_stdout', 'rt').read() == expcmd with open('my_stdout', 'wt') as stdoutf: stdout = run.run('./script.sh 1 2 3', - log={'cmd' : True, 'stdout' : stdoutf}) + log={'cmd' : stdoutf, "stdout" : stdoutf}) assert stdout == expstdout - assert open('my_stdout', 'rt').read() == expstdout + assert open('my_stdout', 'rt').read() == expcmd + expstdout -- GitLab