[conduit: 85/138] Use cgitb to capture information in tracebacks



commit 445bfd177c6bc778f424e2d137d2875b726000aa
Author: John Carr <john carr unrouted co uk>
Date:   Mon May 4 08:46:12 2009 -0700

    Use cgitb to capture information in tracebacks
---
 test/soup/result.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/soup/result.py b/test/soup/result.py
index b495a30..cc43a95 100644
--- a/test/soup/result.py
+++ b/test/soup/result.py
@@ -4,6 +4,7 @@ from soup.utils import progressbar
 
 import sys
 import unittest
+import cgitb
 
 class TestResult(unittest.TestResult):
 
@@ -40,6 +41,14 @@ class TestResult(unittest.TestResult):
         super(TestResult, self).addSuccess(test)
         self.report_success(test)
 
+    def _exc_info_to_string(self, err, test):
+        """Converts a sys.exc_info()-style tuple of values into a string."""
+        exctype, value, tb = err
+        # Skip test runner traceback levels
+        while tb and self._is_relevant_tb_level(tb):
+            tb = tb.tb_next
+        return cgitb.text((exctype, value, tb))
+
     # FIXME: Maybe these should be callbacks?
 
     def report_test_start(self, test):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]