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

fijal at codespeak.net fijal at codespeak.net
Tue Aug 22 12:53:16 CEST 2006


Author: fijal
Date: Tue Aug 22 12:53:13 2006
New Revision: 31462

Modified:
   py/branch/distributed/py/test/rsession/executor.py
   py/branch/distributed/py/test/rsession/testing/example1.py
   py/branch/distributed/py/test/rsession/testing/test_executor.py
Log:
Added traceback test.


Modified: py/branch/distributed/py/test/rsession/executor.py
==============================================================================
--- py/branch/distributed/py/test/rsession/executor.py	(original)
+++ py/branch/distributed/py/test/rsession/executor.py	Tue Aug 22 12:53:13 2006
@@ -27,6 +27,8 @@
             self.fun()
         except Exception, e:
             excinfo = py.code.ExceptionInfo()
+            code = py.code.Code(self.fun)
+            excinfo.traceback = excinfo.traceback.cut(path=code.path, firstlineno=code.firstlineno)
             return FailingOutcome(excinfo)
         else:
             return PassingOutcome()

Modified: py/branch/distributed/py/test/rsession/testing/example1.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/example1.py	(original)
+++ py/branch/distributed/py/test/rsession/testing/example1.py	Tue Aug 22 12:53:13 2006
@@ -1,5 +1,4 @@
 
-
 def f1():
     f2()
 

Modified: py/branch/distributed/py/test/rsession/testing/test_executor.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/test_executor.py	(original)
+++ py/branch/distributed/py/test/rsession/testing/test_executor.py	Tue Aug 22 12:53:13 2006
@@ -15,3 +15,11 @@
     assert not outcome.haspassed() 
     excinfo = outcome.excinfo
     assert excinfo.type == ValueError
+
+def test_executor_traceback():
+    ex = Executor(example1.g1)
+    outcome = ex.execute()
+    excinfo = outcome.excinfo
+    assert len(excinfo.traceback) == 2
+    assert excinfo.traceback[1].frame.code.name == 'g2'
+    assert excinfo.traceback[0].frame.code.name == 'g1'



More information about the pytest-commit mailing list