From 099644f0a7d16d865a39cfab069ab762dc26377f Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 9 Feb 2011 03:40:17 +0200 Subject: s4/tests: Move command line processing into separate method to be reused --- source4/scripting/python/samba/tests/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index 8bb1b0b766..d6b962c1ce 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -124,20 +124,20 @@ class ValidNetbiosNameTests(TestCase): class BlackboxTestCase(TestCase): """Base test case for blackbox tests.""" - def check_run(self, line): + def _make_cmdline(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) + return line + + def check_run(self, line): + line = self._make_cmdline(line) 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) + line = self._make_cmdline(line) p = subprocess.Popen(line, stdout=subprocess.PIPE, shell=True, close_fds=True) retcode = p.wait() if retcode: -- cgit