From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QrdRg-0001Dm-UR for garchives@archives.gentoo.org; Thu, 11 Aug 2011 22:09:45 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 561EA21C3FA; Thu, 11 Aug 2011 22:09:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1574921C3F8 for ; Thu, 11 Aug 2011 22:09:12 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 775621B4036 for ; Thu, 11 Aug 2011 22:09:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 91C1A8004B for ; Thu, 11 Aug 2011 22:09:10 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <150922e396994a0c595cab38af54927474543f57.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/output/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: pmstestsuite/output/html.py X-VCS-Directories: pmstestsuite/output/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 150922e396994a0c595cab38af54927474543f57 Date: Thu, 11 Aug 2011 22:09:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 59b2f43d74ea10dba897ba22026421a6 commit: 150922e396994a0c595cab38af54927474543f57 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Thu Aug 11 22:06:39 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Thu Aug 11 22:06:39 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D150922e3 HTML output: split assertion names into (prefix, realname). --- pmstestsuite/output/html.py | 62 +++++++++++++++++++++++++++----------= ------ 1 files changed, 39 insertions(+), 23 deletions(-) diff --git a/pmstestsuite/output/html.py b/pmstestsuite/output/html.py index 78599db..abcd5af 100644 --- a/pmstestsuite/output/html.py +++ b/pmstestsuite/output/html.py @@ -3,6 +3,8 @@ # Released under the terms of the 2-clause BSD license. =20 from collections import defaultdict +from gentoopm.util import ABCObject +from abc import abstractmethod =20 from pmstestsuite.output import OutputModule =20 @@ -87,12 +89,24 @@ class HTMLOutput(OutputModule): for pm in sorted(pms, key =3D lambda pm: mypms.index(pm)): yield (pm, pms[pm]) =20 - class HTMLElem(object): + class HTMLElem(ABCObject): + @abstractmethod + def set_rowspan(self, rowspan): + pass + + @abstractmethod + def __str__(self): + pass + + class TD(HTMLElem): _elem =3D 'td' =20 - def __init__(self, text): + def __init__(self, text, colspan =3D 1): self._attrs =3D [] self._text =3D text + self._colspan =3D colspan + if colspan !=3D 1: + self._attrs.append('colspan=3D"%d"' % colspan) =20 def set_rowspan(self, rowspan): if rowspan !=3D 1: @@ -102,20 +116,14 @@ class HTMLOutput(OutputModule): return '<%s>%s' % (' '.join([self._elem] + self._attrs), self._text, self._elem) =20 - class TH(HTMLElem): + class TH(TD): _elem =3D 'th' =20 - def __init__(self, text, colspan =3D 1): - HTMLElem.__init__(self, text) - self._colspan =3D colspan - if colspan !=3D 1: - self._attrs.append('colspan=3D"%d"' % colspan) - - class ValCell(HTMLElem): + class ValCell(TD): _color_class =3D '' =20 def __init__(self, text): - HTMLElem.__init__(self, text) + TD.__init__(self, text) self._attrs.append('class=3D"value %s"' % self._color_class) =20 class ColorValCell(ValCell): @@ -145,6 +153,9 @@ class HTMLOutput(OutputModule): def __init__(self): pass =20 + def set_rowspan(self, rowspan): + pass + def __str__(self): return '' =20 @@ -154,14 +165,14 @@ class HTMLOutput(OutputModule): =20 table[0][0] =3D TH('Test name') table[0][1] =3D TH('EAPI') - table[0][2] =3D TH('Assertion') - table[0][3] =3D TH('Expected') + table[0][2] =3D TH('Assertion', colspan =3D 2) + table[0][4] =3D TH('Expected') for i, pm in enumerate(mypms): - table[0][4 + i*2] =3D TH(pm.name, colspan =3D 2) - table[0][5 + i*2] =3D NoCell() - table[1][4 + i*2] =3D TH('Actual') - table[1][5 + i*2] =3D TH('Result') - maxcol =3D 6 + i*2 + table[0][5 + i*2] =3D TH(pm.name, colspan =3D 2) + table[0][6 + i*2] =3D NoCell() + table[1][5 + i*2] =3D TH('Actual') + table[1][6 + i*2] =3D TH('Result') + maxcol =3D 7 + i*2 =20 row =3D 2 for cl, tests in _results_by_class(results): @@ -169,16 +180,21 @@ class HTMLOutput(OutputModule): for t in sorted(tests, key =3D lambda t: t.eapi): table[row][1] =3D t.eapi test_asserts =3D [] - col =3D 4 + col =3D 5 for pm, r in _sorted_pms(tests[t]): table[row][col+1] =3D BoolCell(r) for a in r.assertions: if a.name not in test_asserts: test_asserts.append(a.name) crow =3D row + test_asserts.index(a.name) - table[crow][2] =3D a.name - table[crow][3] =3D ValCell(a.expected) - for c in range(4, maxcol, 2): + if a.prefix is not None: + table[crow][2] =3D a.prefix + table[crow][3] =3D a.unprefixed_name + else: + table[crow][2] =3D TD(a.name, colspan =3D 2) + table[crow][3] =3D NoCell() + table[crow][4] =3D ValCell(a.expected) + for c in range(5, maxcol, 2): table[crow][c] =3D UnknownValCell() else: crow =3D row + test_asserts.index(a.name) @@ -202,7 +218,7 @@ class HTMLOutput(OutputModule): break =20 if not isinstance(cell, HTMLElem): - cell =3D HTMLElem(cell) + cell =3D TD(cell) cell.set_rowspan(rowspan) f.write(str(cell)) f.write('')