From: Kamen Mazdrashki Date: Sun, 20 Feb 2011 02:17:25 +0000 (+0200) Subject: s4/samba.tests: Raise BlackboxProcessError exception in case check_output method... X-Git-Tag: tevent-0.9.11~459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfb0adf0b450452e3daf0b60269768b77c6291c3;p=thirdparty%2Fsamba.git 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 --- diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index 5a0e23daee4..58e41309980 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,