diff --git a/glib/gtester-report b/glib/gtester-report index 52b9dcb87..a0ab600a2 100755 --- a/glib/gtester-report +++ b/glib/gtester-report @@ -17,8 +17,19 @@ # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. +import datetime import optparse import sys, re, xml.dom.minidom + +try: + import subunit + from subunit import iso8601 + from testtools.content import Content, ContentType + mime_utf8 = ContentType('text', 'plain', {'charset': 'utf8'}) +except ImportError: + subunit = None + + pkginstall_configvars = { #@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation } @@ -153,8 +164,25 @@ class ReportReader (TreeProcess): self.last_binary.random_seed = node_as_text (rseed) self.process_children (node) -# HTML report generation class -class ReportWriter (TreeProcess): + +class ReportWriter(object): + """Base class for reporting.""" + + def __init__(self, binary_list): + self.binaries = binary_list + + def _error_text(node): + """Get a string representing the error children of node.""" + rlist = list_children(node, 'error') + txt = '' + for enode in rlist: + txt += node_as_text (enode) + if txt and txt[-1] != '\n': + txt += '\n' + return txt + + +class HTMLReportWriter(ReportWriter): # Javascript/CSS snippet to toggle element visibility cssjs = r'''