1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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
This commit is contained in:
Kamen Mazdrashki 2011-02-20 04:17:25 +02:00
parent 348295bf8a
commit bfb0adf0b4

View File

@ -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,