[py-svn] r31657 - in py/branch/distributed/py/test/rsession: . testing

fijal at codespeak.net fijal at codespeak.net
Fri Aug 25 19:39:47 CEST 2006


Author: fijal
Date: Fri Aug 25 19:39:45 2006
New Revision: 31657

Modified:
   py/branch/distributed/py/test/rsession/outcome.py
   py/branch/distributed/py/test/rsession/testing/test_outcome.py
Log:
Added relative line control, for showing where exactly something went wrong.


Modified: py/branch/distributed/py/test/rsession/outcome.py
==============================================================================
--- py/branch/distributed/py/test/rsession/outcome.py	(original)
+++ py/branch/distributed/py/test/rsession/outcome.py	Fri Aug 25 19:39:45 2006
@@ -27,12 +27,13 @@
     
     def traceback_entry_repr(self, tb_entry):
         lineno = tb_entry.lineno
+        relline = tb_entry.frame.code.firstlineno - lineno + 1
         path = str(tb_entry.path)
         try:
             source = str(tb_entry.getsource())
         except:
             source = "<could not get source>"
-        return (lineno, source, path)
+        return (relline, lineno, source, path)
         
     def make_repr(self):
         return (self.passed, self.setupfailure, 
@@ -41,7 +42,8 @@
 
 class TracebackEntryRepr(object):
     def __init__(self, tbentry):
-        lineno, self.source, self.path = tbentry
+        relline, lineno, self.source, self.path = tbentry
+        self.relline = int(relline)
         self.lineno = int(lineno)
     
     def __repr__(self):

Modified: py/branch/distributed/py/test/rsession/testing/test_outcome.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/test_outcome.py	(original)
+++ py/branch/distributed/py/test/rsession/testing/test_outcome.py	Fri Aug 25 19:39:45 2006
@@ -34,7 +34,10 @@
     myfile = py.magic.autopath()
     assert excinfo.traceback[3].path == myfile
     assert excinfo.traceback[3].lineno == f1.func_code.co_firstlineno
+    assert excinfo.traceback[3].relline == 0
     assert excinfo.traceback[2].path == myfile
     assert excinfo.traceback[2].lineno == f2.func_code.co_firstlineno
+    assert excinfo.traceback[2].relline == 0
     assert excinfo.traceback[1].path == myfile
     assert excinfo.traceback[1].lineno == f3.func_code.co_firstlineno
+    assert excinfo.traceback[1].relline == 0



More information about the pytest-commit mailing list