From 52b5ea0b5c0d2cda593931827d94ba484ed26f32 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Sun, 22 Mar 2015 13:32:36 -0400 Subject: [PATCH] Fix #4. Document debug option. --- docs/index.rst | 3 +++ scripttest.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index b82a8be..6a59559 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -62,6 +62,9 @@ Then you run scripts with ``env.run(script, arg1, arg2, ...)``:: There's several keyword arguments you can use with ``env.run()``: +``debug``: (default False) + Don't pipe output. Note that this will cause the returned object's + ``stdout`` and ``stderr`` attributes to be emtpy strings. ``expect_error``: (default False) Don't raise an exception in case of errors ``expect_stderr``: (default ``expect_error``) diff --git a/scripttest.py b/scripttest.py index d00247e..a2592d8 100644 --- a/scripttest.py +++ b/scripttest.py @@ -196,6 +196,9 @@ def run(self, script, *args, **kw): Keywords allowed are: + ``debug``: (default False) + Don't pipe output. Note that this will cause the returned object's + ``stdout`` and ``stderr`` attributes to be emtpy strings. ``expect_error``: (default False) Don't raise an exception in case of errors ``expect_stderr``: (default ``expect_error``) @@ -255,7 +258,9 @@ def run(self, script, *args, **kw): env=clean_environ(self.environ)) if debug: - stdout, stderr = proc.communicate() + proc.communicate() + stdout = '' + stderr = '' else: stdout, stderr = proc.communicate(stdin) stdout = string(stdout)