[py-svn] r51668 - py/branch/event/py/test2
hpk at codespeak.net
hpk at codespeak.net
Wed Feb 20 09:38:47 CET 2008
Author: hpk
Date: Wed Feb 20 09:38:46 2008
New Revision: 51668
Modified:
py/branch/event/py/test2/executor.py
py/branch/event/py/test2/session.py
Log:
simplify exception catching
Modified: py/branch/event/py/test2/executor.py
==============================================================================
--- py/branch/event/py/test2/executor.py (original)
+++ py/branch/event/py/test2/executor.py Wed Feb 20 09:38:46 2008
@@ -9,6 +9,8 @@
from py.__.test2 import repevent, present
import py.__.test2.custompdb
+sysex = (KeyboardInterrupt, SystemExit, GeneratorExit)
+
class RunExecutor(object):
""" Same as in executor, but just running run
"""
@@ -41,9 +43,7 @@
self.run(capture)
finally:
testrep.stdout, testrep.stderr = self.item._getouterr()
- except Skipped:
- self._fillreport(testrep, py.code.ExceptionInfo())
- except (SystemExit, KeyboardInterrupt):
+ except sysex:
raise
except:
excinfo = py.code.ExceptionInfo()
@@ -51,7 +51,7 @@
excinfo = e.excinfo
self.config.bus.notify(repevent.ItemFinish(self.item, excinfo))
self._fillreport(testrep, excinfo)
- if self.config.option.usepdb:
+ if self.config.option.usepdb and not excinfo.errisinstance(Skipped):
py.__.test2.custompdb.post_mortem(excinfo._excinfo[2])
else:
testrep.passed = True
Modified: py/branch/event/py/test2/session.py
==============================================================================
--- py/branch/event/py/test2/session.py (original)
+++ py/branch/event/py/test2/session.py Wed Feb 20 09:38:46 2008
@@ -82,10 +82,5 @@
return failures
def runtest(self, item):
- cls = RunExecutor
- if self.config.option.boxed:
- cls = BoxExecutor
- executor = cls(item, self.config)
- testrep = executor.execute()
- self.config.bus.notify(testrep)
+ return item.runtest()
More information about the pytest-commit
mailing list