[py-svn] r38572 - py/trunk/py/test/rsession

fijal at codespeak.net fijal at codespeak.net
Mon Feb 12 16:27:48 CET 2007


Author: fijal
Date: Mon Feb 12 16:27:46 2007
New Revision: 38572

Modified:
   py/trunk/py/test/rsession/outcome.py
Log:
Move a bit into using high-level traceback interface instead of low-level one


Modified: py/trunk/py/test/rsession/outcome.py
==============================================================================
--- py/trunk/py/test/rsession/outcome.py	(original)
+++ py/trunk/py/test/rsession/outcome.py	Mon Feb 12 16:27:46 2007
@@ -29,10 +29,17 @@
         tb_info = [self.traceback_entry_repr(x, tbstyle)
                    for x in excinfo.traceback]
         rec_index = excinfo.traceback.recursionindex()
-        etype = excinfo.type
-        if hasattr(etype, '__name__'):
-            etype = etype.__name__
-        return (etype, str(excinfo.value), (tb_info, rec_index))
+        if hasattr(excinfo, 'type'):
+            etype = excinfo.type
+            if hasattr(etype, '__name__'):
+                etype = etype.__name__
+        else:
+            etype = excinfo.typename
+        val = getattr(excinfo, 'value', None)
+        if not val:
+            val = exinfo.exconly()
+        val = str(val)
+        return (etype, val, (tb_info, rec_index))
     
     def traceback_entry_repr(self, tb_entry, tb_style):
         lineno = tb_entry.lineno
@@ -46,7 +53,7 @@
                 source = str(tb_entry.getsource()).split("\n")[relline]
         except py.error.ENOENT:
             source = "[cannot get source]"
-        name = tb_entry.frame.code.raw.co_name
+        name = str(tb_entry.frame.code.name)
         # XXX: Bare except. What can getsource() raise anyway?
         # SyntaxError, AttributeError, IndentationError for sure, check it
         #except:



More information about the pytest-commit mailing list