[pypy-svn] r68590 - in pypy/build/bot2/pypybuildbot: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Oct 17 18:12:04 CEST 2009
Author: arigo
Date: Sat Oct 17 18:12:04 2009
New Revision: 68590
Modified:
pypy/build/bot2/pypybuildbot/summary.py
pypy/build/bot2/pypybuildbot/test/test_summary.py
Log:
Hack with JavaScript to allow us to hide a column
if it just contains a lot of F's.
Modified: pypy/build/bot2/pypybuildbot/summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/summary.py (original)
+++ pypy/build/bot2/pypybuildbot/summary.py Sat Oct 17 18:12:04 2009
@@ -415,14 +415,18 @@
lines.append(line)
lines.append([bars(), "\n"])
+ a_num = len(self.sections)
if self.SUCCESS_LINE:
success = []
for label, outcome_set in by_label:
symbol = "+"
clazz = "success"
if outcome_set.failed:
- symbol = "-"
clazz = "failed"
+ symbol = html.a("-",
+ id="a%dc%d" % (a_num, 1<<len(success)),
+ href="javascript:togglestate(%d,%d)" % (
+ a_num, 1<<len(success)))
success.append([" ",
html.span(symbol,
class_="failSummary "+clazz)])
@@ -445,9 +449,12 @@
for failure in sorted(failed, key=sorting):
line = []
- for label, outcome_set in by_label:
+ combination = 0
+ for i, (label, outcome_set) in enumerate(by_label):
letter = outcome_set.get_outcome(failure)
- failed = letter.lower() not in ('s', '.')
+ failed = letter.lower() not in ('s', '.', ' ')
+ if failed:
+ combination |= 1 << i
if outcome_set.get_longrepr(failure):
longrepr_url = self.make_longrepr_url_for(outcome_set,
failure)
@@ -474,8 +481,9 @@
for width, key in zip(colwidths[1:], failure[1:]):
line.append(" %-*s" % (width, key))
- lines.append(line)
- lines.append("\n")
+ line.append('\n')
+ lines.append(html.span(line,
+ class_="a%dc%d" % (a_num, combination)))
section = html.pre(lines)
self.sections.append(section)
@@ -778,3 +786,39 @@
page.add_comment('t=%.2f; %s' % (total_time,
outcome_set_cache.stats()))
return page.render()
+
+ def head(self, request):
+ return """
+ <script language=javascript type='text/javascript'>
+ hiddenstates = [ ];
+ function togglestate(a, c) {
+ var start = "a" + a + "c";
+ var link = document.getElementById(start + c);
+ var state = hiddenstates[a];
+ if (!state) state = 0;
+ if (state & c) {
+ state = state - c;
+ link.textContent = '-';
+ }
+ else {
+ state = state | c;
+ link.textContent = 'H';
+ }
+ hiddenstates[a] = state;
+ var items = document.getElementsByTagName('span');
+ var i = items.length;
+ var toggle = "";
+ while (i > 0) {
+ i--;
+ var span = items.item(i);
+ if (span.className.substr(0, start.length) == start) {
+ var k = span.className.substr(start.length);
+ if ((state & k) == k)
+ span.style.display = 'none';
+ else
+ span.style.display = 'block';
+ }
+ }
+ }
+ </script>
+ """
Modified: pypy/build/bot2/pypybuildbot/test/test_summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/test/test_summary.py (original)
+++ pypy/build/bot2/pypybuildbot/test/test_summary.py Sat Oct 17 18:12:04 2009
@@ -491,7 +491,7 @@
assert 'TEST1' in out
assert ':-)' in out
- assert '\n <span class="failSummary failed">-</span> <span class="failSummary success">+</span> success' in out
+ assert '\n <span class="failSummary failed"><a href="javascript:togglestate(1,1)" id="a1c1">-</a></span> <span class="failSummary success">+</span> success' in out
def test_two_builds_samerev(self):
builder = status_builder.BuilderStatus('builder0')
More information about the Pypy-commit
mailing list