[py-svn] r7971 - py/dist/py/test
arigo at codespeak.net
arigo at codespeak.net
Wed Dec 22 18:48:24 CET 2004
Author: arigo
Date: Wed Dec 22 18:48:24 2004
New Revision: 7971
Modified:
py/dist/py/test/drive.py
py/dist/py/test/item.py
Log:
Test items cannot return anything any more; instead, they should always raise
instead of return an Outcome if they wish to do so. Also, they can now raise
an Outcome with a custom excinfo attribute that won't be overwritten.
Modified: py/dist/py/test/drive.py
==============================================================================
--- py/dist/py/test/drive.py (original)
+++ py/dist/py/test/drive.py Wed Dec 22 18:48:24 2004
@@ -89,13 +89,16 @@
if not self.option.collectonly:
self.reporter.startitem(item)
try:
- res = item.run(self) or item.Passed()
+ item.run(self)
except item.Outcome, res:
- res.excinfo = py.code.ExceptionInfo()
+ if not hasattr(res, 'excinfo'):
+ res.excinfo = py.code.ExceptionInfo()
except (KeyboardInterrupt, SystemExit):
raise
except:
res = item.Failed(excinfo=py.code.ExceptionInfo())
+ else:
+ res = item.Passed()
res.item = item
self.reporter.enditem(res)
if isinstance(res, (item.Failed,)):
Modified: py/dist/py/test/item.py
==============================================================================
--- py/dist/py/test/item.py (original)
+++ py/dist/py/test/item.py Wed Dec 22 18:48:24 2004
@@ -84,7 +84,7 @@
""" default implementation for calling a test target is to
simply call it.
"""
- return target(*args)
+ target(*args)
def reprcall(self):
""" return a string representing a call to the underlying
More information about the pytest-commit
mailing list