From 8530d5afdee8fbc4d87398839d37c503dc05410d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 13 Sep 2010 20:53:54 +0200 Subject: subunit: Initial work on using the standard TestResult class. --- selftest/format-subunit | 7 ++++--- selftest/subunithelper.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'selftest') diff --git a/selftest/format-subunit b/selftest/format-subunit index b4509ab1cf..31136b05ff 100755 --- a/selftest/format-subunit +++ b/selftest/format-subunit @@ -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: diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index f5e07a1d9a..11b581f6f1 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -20,6 +20,7 @@ __all__ = ['parse_results'] import re import sys import subunit +import testtools import time VALID_RESULTS = ['success', 'successful', 'failure', 'fail', 'skip', 'knownfail', 'error', 'xfail', 'skip-testsuite', 'testsuite-failure', 'testsuite-xfail', 'testsuite-success', 'testsuite-error'] @@ -253,7 +254,7 @@ def find_in_list(regexes, fullname): return None -class FilterOps(object): +class FilterOps(testtools.testresult.TestResult): def control_msg(self, msg): pass # We regenerate control messages, so ignore this -- cgit