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:
parent
348295bf8a
commit
bfb0adf0b4
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user