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

pedronis at codespeak.net pedronis at codespeak.net
Sun Jan 11 23:31:35 CET 2009


Author: pedronis
Date: Sun Jan 11 23:31:34 2009
New Revision: 60893

Modified:
   pypy/build/bot2/pypybuildbot/summary.py
   pypy/build/bot2/pypybuildbot/test/test_summary.py
Log:
try to support tracebacks with non-ascii in them (utf-8 or latin-1)



Modified: pypy/build/bot2/pypybuildbot/summary.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/summary.py	(original)
+++ pypy/build/bot2/pypybuildbot/summary.py	Sun Jan 11 23:31:34 2009
@@ -54,6 +54,11 @@
             self.failed.add(namekey)
 
         if longrepr:
+            try:
+                longrepr = longrepr.decode("utf-8")
+            except UnicodeDecodeError:
+                longrepr = longrepr.decode("latin-1")
+            
             self.longreprs[namekey] = longrepr
 
     @property

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 11 23:31:34 2009
@@ -69,6 +69,24 @@
         res = rev_outcome_set.get_longrepr(("a.b", "test_one"))
         assert res == "some\ntraceback\n"
 
+    def test_populate_encodings(self):
+        rev_outcome_set = summary.RevisionOutcomeSet(50000)
+        log = StringIO("""F a/b.py:test_one
+ \xe5 foo
+F a/b.py:test_two
+ \xc3\xa5 bar
+""")
+        
+        rev_outcome_set.populate(log)
+
+        assert len(rev_outcome_set.failed) == 2
+        assert rev_outcome_set.numpassed == 0
+
+        assert rev_outcome_set.longreprs == {
+("a.b","test_one"): u"\xe5 foo\n",
+("a.b", "test_two"): u"\xe5 bar\n"
+            }
+
     def test_populate_special(self):
         rev_outcome_set = summary.RevisionOutcomeSet(50000)
         log = StringIO("""F a/b.py



More information about the Pypy-commit mailing list