s4:python tests __init__.py - do not depend on "subprocess.CalledProcessError"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 9 Jan 2012 10:55:08 +0000 (11:55 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 9 Jan 2012 22:08:36 +0000 (23:08 +0100)
The class is not present in Python 2.4

Reviewed-by: Jelmer
source4/scripting/python/samba/tests/__init__.py

index ce2572fe8b3325a96493cd1d1c651ee0a2a754ea..d9fbb15a028e34b5ac58de01d4a0e4bd0f789481 100644 (file)
@@ -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)