[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Mon Jan 9 16:42:02 MST 2012
The branch, master has been updated
via 354e43c s4:python tests __init__.py - do not depend on "subprocess.check_call()"
via a43b472 s4:python tests __init__.py - do not depend on "subprocess.CalledProcessError"
from 7104ce3 s3: Remove an unused label
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 354e43ca1e1a671a9a2a64e40d8fedc19b848ce6
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Mon Jan 9 13:21:49 2012 +0100
s4:python tests __init__.py - do not depend on "subprocess.check_call()"
Method not present in Python 2.4
Reviewed-by: Jelmer
Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
Autobuild-Date: Tue Jan 10 00:41:59 CET 2012 on sn-devel-104
commit a43b472b62be7d270f1dea0fc3557097f40fcee1
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date: Mon Jan 9 11:55:08 2012 +0100
s4:python tests __init__.py - do not depend on "subprocess.CalledProcessError"
The class is not present in Python 2.4
Reviewed-by: Jelmer
-----------------------------------------------------------------------
Summary of changes:
source4/scripting/python/samba/tests/__init__.py | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index ce2572f..e2baa74 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -123,15 +123,20 @@ class ValidNetbiosNameTests(TestCase):
self.assertFalse(samba.valid_netbios_name("*BLA"))
-class BlackboxProcessError(subprocess.CalledProcessError):
- """This exception is raised when a process run by check_output() returns
- a non-zero exit status. Exception instance should contain
- the exact exit code (S.returncode), command line (S.cmd),
- process output (S.stdout) and process error stream (S.stderr)"""
+class BlackboxProcessError(Exception):
+ """This is raised when check_output() process returns a non-zero exit status
+
+ Exception instance should contain the exact exit code (S.returncode),
+ command line (S.cmd), process output (S.stdout) and process error stream
+ (S.stderr)
+ """
+
def __init__(self, returncode, cmd, stdout, stderr):
- super(BlackboxProcessError, self).__init__(returncode, cmd)
+ self.returncode = returncode
+ self.cmd = cmd
self.stdout = stdout
self.stderr = stderr
+
def __str__(self):
return "Command '%s'; exit status %d; stdout: '%s'; stderr: '%s'" % (self.cmd, self.returncode,
self.stdout, self.stderr)
@@ -149,7 +154,10 @@ class BlackboxTestCase(TestCase):
def check_run(self, line):
line = self._make_cmdline(line)
- subprocess.check_call(line, shell=True)
+ p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ retcode = p.wait()
+ if retcode:
+ raise BlackboxProcessError(retcode, line, p.stdout.read(), p.stderr.read())
def check_output(self, line):
line = self._make_cmdline(line)
--
Samba Shared Repository
More information about the samba-cvs
mailing list