From 6b1574636a8493d043795b7f397657846a637f28 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 9 Feb 2011 03:01:16 +0200 Subject: s4/tests: Implement BlackboxTestCase.check_output() method I am going to need this to check if output is OK (kind of) --- source4/scripting/python/samba/tests/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source4') diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index d0362efb4a..8bb1b0b766 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -132,6 +132,17 @@ class BlackboxTestCase(TestCase): line = " ".join(parts) subprocess.check_call(line, shell=True) + def check_output(self, line): + bindir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../bin")) + parts = line.split(" ") + if os.path.exists(os.path.join(bindir, parts[0])): + parts[0] = os.path.join(bindir, parts[0]) + line = " ".join(parts) + p = subprocess.Popen(line, stdout=subprocess.PIPE, shell=True, close_fds=True) + retcode = p.wait() + if retcode: + raise subprocess.CalledProcessError(retcode, line) + return p.stdout.read() def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None, flags=0, ldb_options=None, ldap_only=False): -- cgit