subunit: Initial work on using the standard TestResult class.
[ira/wip.git] / selftest / format-subunit
index b4509ab1cfcfc4d56ab07547daf00c7293717471..31136b05ffa47790b2f72ec14a2c65f0b645f67a 100755 (executable)
@@ -14,6 +14,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../lib/testtools"))
 
 import subunithelper
 import subunit
+import testtools
 
 def format_time(t):
     minutes, seconds = divmod(t, 60)
@@ -27,7 +28,7 @@ def format_time(t):
     return ret
 
 
-class PlainFormatter(object):
+class PlainFormatter(testtools.testresult.TestResult):
 
     def __init__(self, summaryfile, verbose, immediate, statistics,
             totaltests=None):
@@ -69,7 +70,7 @@ class PlainFormatter(object):
         duration = testsuite_start_time - self.start_time
 
         if not self.verbose:
-            self.test_output[name] = "" 
+            self.test_output[name] = ""
 
         out = "[%d" % self.index
         if self.totalsuites is not None:
@@ -77,7 +78,7 @@ class PlainFormatter(object):
         out += " in " + format_time(duration)
         if self.suitesfailed:
             out += ", %d errors" % (len(self.suitesfailed),)
-        out += "] %s" % name 
+        out += "] %s" % name
         if self.immediate:
             sys.stdout.write(out + "\n")
         else: