summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2011-02-09 03:40:17 +0200
committerKamen Mazdrashki <kamenim@samba.org>2011-02-09 11:57:13 +0200
commit099644f0a7d16d865a39cfab069ab762dc26377f (patch)
treec9a0b4e5b529373f2c97aed797b3ea244687f569
parent6b1574636a8493d043795b7f397657846a637f28 (diff)
downloadsamba-099644f0a7d16d865a39cfab069ab762dc26377f.tar.gz
samba-099644f0a7d16d865a39cfab069ab762dc26377f.tar.bz2
samba-099644f0a7d16d865a39cfab069ab762dc26377f.zip
s4/tests: Move command line processing into separate method to be reused
-rw-r--r--source4/scripting/python/samba/tests/__init__.py12
1 files changed, 6 insertions, 6 deletions
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: