[py-svn] r51665 - py/branch/event/py/test2
hpk at codespeak.net
hpk at codespeak.net
Wed Feb 20 08:51:50 CET 2008
Author: hpk
Date: Wed Feb 20 08:51:46 2008
New Revision: 51665
Modified:
py/branch/event/py/test2/outcome.py
Log:
streamline py.test.* helpers a bit
Modified: py/branch/event/py/test2/outcome.py
==============================================================================
--- py/branch/event/py/test2/outcome.py (original)
+++ py/branch/event/py/test2/outcome.py Wed Feb 20 08:51:46 2008
@@ -8,6 +8,9 @@
import sys
class Outcome:
+ """ Outcome and its subclass instances indicate and
+ contain info about test and collection outcomes.
+ """
def __init__(self, msg=None, excinfo=None):
self.msg = msg
self.excinfo = excinfo
@@ -21,6 +24,9 @@
class Passed(Outcome):
pass
+class Skipped(Outcome):
+ pass
+
class Failed(Outcome):
pass
@@ -30,20 +36,18 @@
self.expr = expr
self.expected = expected
-class Skipped(Outcome):
- pass
-
class Exit(Exception):
""" for immediate program exits without tracebacks and reporter/summary. """
- def __init__(self, msg="unknown reason", item=None):
+ def __init__(self, msg="unknown reason"):
self.msg = msg
Exception.__init__(self, msg)
# exposed helper methods
-def exit(msg, item=None):
+def exit(msg):
""" exit testing process immediately. """
- raise Exit(msg=msg, item=item)
+ __tracebackhide__ = True
+ raise Exit(msg)
def skip(msg=""):
""" skip with the given Message. """
@@ -59,8 +63,8 @@
""" raise AssertionError, if target code does not raise the expected
exception.
"""
- assert args
__tracebackhide__ = True
+ assert args
if isinstance(args[0], str):
expr, = args
assert isinstance(expr, str)
More information about the py-svn
mailing list