[py-svn] r48138 - py/branch/reporter-merge/py/test

fijal at codespeak.net fijal at codespeak.net
Sun Oct 28 19:22:42 CET 2007


Author: fijal
Date: Sun Oct 28 19:22:42 2007
New Revision: 48138

Modified:
   py/branch/reporter-merge/py/test/executor.py
   py/branch/reporter-merge/py/test/session.py
Log:
Share more code.


Modified: py/branch/reporter-merge/py/test/executor.py
==============================================================================
--- py/branch/reporter-merge/py/test/executor.py	(original)
+++ py/branch/reporter-merge/py/test/executor.py	Sun Oct 28 19:22:42 2007
@@ -60,7 +60,7 @@
                 py.__.test.custompdb.post_mortem(excinfo._excinfo[2])
                 # XXX hmm, we probably will not like to continue from that
                 #     point
-                raise SystemExit()
+                #raise SystemExit()
         outcome.stdout, outcome.stderr = self.item._getouterr()
         return outcome
 

Modified: py/branch/reporter-merge/py/test/session.py
==============================================================================
--- py/branch/reporter-merge/py/test/session.py	(original)
+++ py/branch/reporter-merge/py/test/session.py	Sun Oct 28 19:22:42 2007
@@ -5,6 +5,7 @@
 from py.__.test import repevent
 from py.__.test.outcome import SerializableOutcome, ReprOutcome
 from py.__.test.reporter import LocalReporter
+from py.__.test.executor import RunExecutor
 
 """ The session implementation - reporter version:
 
@@ -143,39 +144,9 @@
             self.footer(colitems)
 
     def run(self, item):
-        try:
-            item.startcapture()
-            try:
-                item.run()
-            finally:
-                item.finishcapture()
-            outcome = SerializableOutcome()
-        except Skipped:
-            e = py.code.ExceptionInfo()
-            outcome = SerializableOutcome(skipped=e)
-        except (SystemExit, KeyboardInterrupt):
-            raise
-        except:
-            e = sys.exc_info()[1]
-            if isinstance(e, Failed) and e.excinfo:
-                excinfo = e.excinfo
-            else:
-                excinfo = py.code.ExceptionInfo()
-                if isinstance(item, py.test.collect.Function): 
-                    fun = item.obj # hope this is stable 
-                    code = py.code.Code(fun)
-                    excinfo.traceback = excinfo.traceback.cut(
-                        path=code.path, firstlineno=code.firstlineno)
-            outcome = SerializableOutcome(excinfo=excinfo, setupfailure=False)
-            if self.config.option.usepdb:
-                if self.reporter is not None:
-                    self.reporter(repevent.ImmediateFailure(item,
-                        ReprOutcome(outcome.make_repr
-                                    (self.config.option.tbstyle))))
-                py.__.test.custompdb.post_mortem(excinfo._excinfo[2])
-
-        outcome.stdout, outcome.stderr = item._getouterr()
-        return ReprOutcome(outcome.make_repr())
+        executor = RunExecutor(item, self.config.option.usepdb, self.reporter,
+                               self.config)
+        return ReprOutcome(executor.execute().make_repr())
 
 class Exit(Exception):
     """ for immediate program exits without tracebacks and reporter/summary. """


More information about the py-svn mailing list