]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Added a simple @future test marker.
authorJason Kirtland <jek@discorporate.us>
Mon, 28 Jan 2008 19:58:39 +0000 (19:58 +0000)
committerJason Kirtland <jek@discorporate.us>
Mon, 28 Jan 2008 19:58:39 +0000 (19:58 +0000)
test/testlib/testing.py

index bb3d2c3a5414ba0c3e57111204b48962701d861f..32e5e9b4a188e2975b34c8fc4b0edecef81975b8 100644 (file)
@@ -57,6 +57,25 @@ def fails_if(callable_):
     return decorate
 
 
+def future(fn):
+    """Mark a test as expected to unconditionally fail.
+
+    Takes no arguments, omit parens when using as a decorator.
+    """
+
+    fn_name = fn.__name__
+    def decorated(*args, **kw):
+        try:
+            fn(*args, **kw)
+        except Exception, ex:
+            print ("Future test '%s' failed as expected: %s " % (
+                fn_name, str(ex)))
+            return True
+        else:
+            raise AssertionError(
+                "Unexpected success for future test '%s'" % fn_name)
+    return _function_named(decorated, fn_name)
+
 def fails_on(*dbs):
     """Mark a test as expected to fail on one or more database implementations.