diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2012-01-09 11:55:08 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2012-01-09 23:08:36 +0100 |
commit | a43b472b62be7d270f1dea0fc3557097f40fcee1 (patch) | |
tree | ddbc67a0943e8a834d5916c081a5b6f7172b35ae | |
parent | 7104ce3220f9c7b301d1c638d071be2a86755c7e (diff) | |
download | samba-a43b472b62be7d270f1dea0fc3557097f40fcee1.tar.gz samba-a43b472b62be7d270f1dea0fc3557097f40fcee1.tar.bz2 samba-a43b472b62be7d270f1dea0fc3557097f40fcee1.zip |
s4:python tests __init__.py - do not depend on "subprocess.CalledProcessError"
The class is not present in Python 2.4
Reviewed-by: Jelmer
-rw-r--r-- | source4/scripting/python/samba/tests/__init__.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index ce2572fe8b..d9fbb15a02 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) |