From: Jason Kirtland Date: Mon, 28 Jan 2008 19:58:39 +0000 (+0000) Subject: - Added a simple @future test marker. X-Git-Tag: rel_0_4_3~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5dd96590a808ed022780f9932f0a4380d494124;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Added a simple @future test marker. --- diff --git a/test/testlib/testing.py b/test/testlib/testing.py index bb3d2c3a54..32e5e9b4a1 100644 --- a/test/testlib/testing.py +++ b/test/testlib/testing.py @@ -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.