From bfb0adf0b450452e3daf0b60269768b77c6291c3 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Sun, 20 Feb 2011 04:17:25 +0200 Subject: [PATCH] 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 --- source4/scripting/python/samba/tests/__init__.py | 4 ++-- 1 file 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, -- 2.34.1