[pypy-svn] r61335 - in pypy/build/bot2/pypybuildbot: . test

pedronis at codespeak.net pedronis at codespeak.net
Sun Jan 25 22:30:32 CET 2009


Author: pedronis
Date: Sun Jan 25 22:30:29 2009
New Revision: 61335

Modified:
   pypy/build/bot2/pypybuildbot/summary.py
   pypy/build/bot2/pypybuildbot/test/test_summary.py
Log:
- solve an aligment problem when versions displayed have different numbers of digits
- show the test run dates



Modified: pypy/build/bot2/pypybuildbot/summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/summary.py	(original)
+++ pypy/build/bot2/pypybuildbot/summary.py	Sun Jan 25 22:30:29 2009
@@ -136,7 +136,8 @@
                   step.getResults()[0] in (FAILURE, EXCEPTION)):
                 failure = ' '.join(step.getText())
 
-        run_info = {'URL': run_url, 'elapsed': pytest_elapsed or None}
+        run_info = {'URL': run_url, 'elapsed': pytest_elapsed or None,
+                    'times': build.getTimes()}
         outcome_set = RevisionOutcomeSet(rev, key, run_info)
         someresult = False
         if pytest_logs:
@@ -272,18 +273,37 @@
     def make_run_anchors_for(self, outcome_set):
         anchors = []
         infos = sorted(outcome_set.get_run_infos().items())
+        minend = None
+        maxend = None
         for cachekey, (run, info) in infos:
             builder = cachekey[0]
             anchors.append('  ')
             timing = ""
             if self.fixed_builder and info['elapsed'] is not None:
                 timing = " in %s" % show_elapsed(info['elapsed'])
+            if info['times'][1] is not None:
+                day = time.localtime(info['times'][1])[:3]
+                if minend is None:
+                    minend = day
+                else:
+                    minend = min(minend, day)
+                if maxend is None:
+                    maxend = day
+                else:
+                    maxend = max(maxend, day)
             text = "%s [%d, %d F, %d s%s]" % (builder,
                                             run.numpassed,
                                             len(run.failed),
                                             len(run.skipped),
                                             timing)
             anchors.append(html.a(text, href=host_agnostic(info['URL'])))
+        if maxend is not None:
+            mintxt = time.strftime("%d %b", minend+(0,)*6)
+            maxtxt = time.strftime("%d %b", maxend+(0,)*6)
+            if maxend == minend:
+                anchors.append(' (%s)' % maxtxt)
+            else:
+                anchors.append(' (%s..%s)' % (mintxt, maxtxt))
         return anchors
 
     def start_cat_branch(self, cat_branch):
@@ -326,16 +346,18 @@
             # rev
             return outcome_set.revision
 
-    def _label_anchor(self, outcome_set):
+    def _label_anchor(self, outcome_set, revsize):
         rev = outcome_set.revision
         if self.fixed_builder:
             pick = "builder=%s&builds=%d" % self._builder_num(outcome_set)
         else:
             pick = "recentrev=%d" % rev
         category, branch = self.cur_cat_branch
-        rev_anchor = html.a(str(rev), href="/summary?category=%s&branch=%s&%s" %
+        revtxt = str(rev)
+        rev_anchor = html.a(revtxt, href="/summary?category=%s&branch=%s&%s" %
                             (category, branch, pick))
-        return rev_anchor
+        rightalign = ' '*(revsize-len(revtxt))
+        return [rev_anchor, rightalign]
                             
     def add_section(self, outcome_sets):
         if not outcome_sets:
@@ -344,15 +366,19 @@
                         for outcome_set in outcome_sets)
         by_label = sorted((self._label(outcome_set), outcome_set)
                           for outcome_set in outcome_sets)
+        revs = [outcome_set.revision for outcome_set in outcome_sets]
+
         lines = []
 
-        align = 2*len(labels)-1+len(str(labels[-1]))
+        revsize = len(str(max(revs)))
+
+        align = 2*len(labels)-1+revsize
         def bars():
             return ' |'*len(lines)
         for label, outcome_set in by_label:
             count_failures = len(outcome_set.failed)
             count_skipped = len(outcome_set.skipped)
-            line = [bars(), ' ', self._label_anchor(outcome_set)]
+            line = [bars(), ' '] + self._label_anchor(outcome_set, revsize)
             line.append((align-len(line[0]))*" ")
             line.append(self.make_run_anchors_for(outcome_set))
             line.append('\n')

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	Sun Jan 25 22:30:29 2009
@@ -636,4 +636,35 @@
         assert "{foo}" in out
         assert "{bar}" in out
 
-        
+    def test_two_builds_different_rev_digits(self):
+        builder = status_builder.BuilderStatus('builder0')
+        add_builds(builder, [(999, "F TEST1\n. b"),
+                             (1000, "F TEST1\n. b")])
+
+        s = summary.Summary()
+        req = FakeRequest([builder])
+        out = s.body(req)
+        p999 = out.find('999')
+        p999builder0 = out.find('builder0', p999)
+        p1000 = out.find('1000')
+        p1000builder0 = out.find('builder0', p1000)
+        assert p999builder0-p999 == p1000builder0-p1000+1
+
+    def test_build_times(self):
+        builder1 = status_builder.BuilderStatus('builder1')
+        builder2 = status_builder.BuilderStatus('builder2')
+ 
+        add_builds(builder1, [(60000, "F TEST1\n")])
+        add_builds(builder2, [(60000, "F TEST2\n")])
+
+        builder1.getBuild(0).finished = 1228258800 # 3 Dec 2008
+        builder2.getBuild(0).finished = 1228431600 # 5 Dec 2008
+
+        s = summary.Summary()
+        req = FakeRequest([builder1, builder2])
+        out = s.body(req)
+
+        assert '(03 Dec..05 Dec)' in out
+         
+
+         



More information about the Pypy-commit mailing list