From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/output/
Date: Thu, 11 Aug 2011 22:09:10 +0000 (UTC) [thread overview]
Message-ID: <150922e396994a0c595cab38af54927474543f57.mgorny@gentoo> (raw)
commit: 150922e396994a0c595cab38af54927474543f57
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 11 22:06:39 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 11 22:06:39 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=150922e3
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.
from collections import defaultdict
+from gentoopm.util import ABCObject
+from abc import abstractmethod
from pmstestsuite.output import OutputModule
@@ -87,12 +89,24 @@ class HTMLOutput(OutputModule):
for pm in sorted(pms, key = lambda pm: mypms.index(pm)):
yield (pm, pms[pm])
- class HTMLElem(object):
+ class HTMLElem(ABCObject):
+ @abstractmethod
+ def set_rowspan(self, rowspan):
+ pass
+
+ @abstractmethod
+ def __str__(self):
+ pass
+
+ class TD(HTMLElem):
_elem = 'td'
- def __init__(self, text):
+ def __init__(self, text, colspan = 1):
self._attrs = []
self._text = text
+ self._colspan = colspan
+ if colspan != 1:
+ self._attrs.append('colspan="%d"' % colspan)
def set_rowspan(self, rowspan):
if rowspan != 1:
@@ -102,20 +116,14 @@ class HTMLOutput(OutputModule):
return '<%s>%s</%s>' % (' '.join([self._elem] + self._attrs),
self._text, self._elem)
- class TH(HTMLElem):
+ class TH(TD):
_elem = 'th'
- def __init__(self, text, colspan = 1):
- HTMLElem.__init__(self, text)
- self._colspan = colspan
- if colspan != 1:
- self._attrs.append('colspan="%d"' % colspan)
-
- class ValCell(HTMLElem):
+ class ValCell(TD):
_color_class = ''
def __init__(self, text):
- HTMLElem.__init__(self, text)
+ TD.__init__(self, text)
self._attrs.append('class="value %s"' % self._color_class)
class ColorValCell(ValCell):
@@ -145,6 +153,9 @@ class HTMLOutput(OutputModule):
def __init__(self):
pass
+ def set_rowspan(self, rowspan):
+ pass
+
def __str__(self):
return ''
@@ -154,14 +165,14 @@ class HTMLOutput(OutputModule):
table[0][0] = TH('Test name')
table[0][1] = TH('EAPI')
- table[0][2] = TH('Assertion')
- table[0][3] = TH('Expected')
+ table[0][2] = TH('Assertion', colspan = 2)
+ table[0][4] = TH('Expected')
for i, pm in enumerate(mypms):
- table[0][4 + i*2] = TH(pm.name, colspan = 2)
- table[0][5 + i*2] = NoCell()
- table[1][4 + i*2] = TH('Actual')
- table[1][5 + i*2] = TH('Result')
- maxcol = 6 + i*2
+ table[0][5 + i*2] = TH(pm.name, colspan = 2)
+ table[0][6 + i*2] = NoCell()
+ table[1][5 + i*2] = TH('Actual')
+ table[1][6 + i*2] = TH('Result')
+ maxcol = 7 + i*2
row = 2
for cl, tests in _results_by_class(results):
@@ -169,16 +180,21 @@ class HTMLOutput(OutputModule):
for t in sorted(tests, key = lambda t: t.eapi):
table[row][1] = t.eapi
test_asserts = []
- col = 4
+ col = 5
for pm, r in _sorted_pms(tests[t]):
table[row][col+1] = BoolCell(r)
for a in r.assertions:
if a.name not in test_asserts:
test_asserts.append(a.name)
crow = row + test_asserts.index(a.name)
- table[crow][2] = a.name
- table[crow][3] = ValCell(a.expected)
- for c in range(4, maxcol, 2):
+ if a.prefix is not None:
+ table[crow][2] = a.prefix
+ table[crow][3] = a.unprefixed_name
+ else:
+ table[crow][2] = TD(a.name, colspan = 2)
+ table[crow][3] = NoCell()
+ table[crow][4] = ValCell(a.expected)
+ for c in range(5, maxcol, 2):
table[crow][c] = UnknownValCell()
else:
crow = row + test_asserts.index(a.name)
@@ -202,7 +218,7 @@ class HTMLOutput(OutputModule):
break
if not isinstance(cell, HTMLElem):
- cell = HTMLElem(cell)
+ cell = TD(cell)
cell.set_rowspan(rowspan)
f.write(str(cell))
f.write('</tr>')
next reply other threads:[~2011-08-11 22:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-11 22:09 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-09 23:01 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/output/ Michał Górny
2012-01-03 15:52 Michał Górny
2011-08-15 18:06 Michał Górny
2011-08-12 9:35 Michał Górny
2011-08-11 22:09 Michał Górny
2011-08-11 8:53 Michał Górny
2011-08-11 8:53 Michał Górny
2011-08-06 14:25 Michał Górny
2011-08-06 14:25 Michał Górny
2011-08-06 8:31 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 19:54 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=150922e396994a0c595cab38af54927474543f57.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox