diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2011-02-20 04:17:25 +0200 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2011-02-20 23:13:12 +0200 |
commit | bfb0adf0b450452e3daf0b60269768b77c6291c3 (patch) | |
tree | 519899bc56da3f428c013b75aa588428fb67dcd3 | |
parent | 348295bf8ac5f39e5be23c0a6adb8c31e64766a2 (diff) | |
download | samba-bfb0adf0b450452e3daf0b60269768b77c6291c3.tar.gz samba-bfb0adf0b450452e3daf0b60269768b77c6291c3.tar.bz2 samba-bfb0adf0b450452e3daf0b60269768b77c6291c3.zip |
s4/samba.tests: Raise BlackboxProcessError exception in case check_output method fails
This way the caller gets the chance to receive STDOUT and STDERR for
a failed process.
We may use this info to check if a process has failed properly,
e.g. with expected output
-rw-r--r-- | source4/scripting/python/samba/tests/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index 5a0e23daee..58e4130998 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -151,10 +151,10 @@ class BlackboxTestCase(TestCase): def check_output(self, line): line = self._make_cmdline(line) - p = subprocess.Popen(line, stdout=subprocess.PIPE, shell=True, close_fds=True) + p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, close_fds=True) retcode = p.wait() if retcode: - raise subprocess.CalledProcessError(retcode, line) + raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read()) return p.stdout.read() def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None, |