summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/test/testing.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/test/testing.py')
-rw-r--r--lib/sqlalchemy/test/testing.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/sqlalchemy/test/testing.py b/lib/sqlalchemy/test/testing.py
index ea1dfa9ea..1b4e1f78c 100644
--- a/lib/sqlalchemy/test/testing.py
+++ b/lib/sqlalchemy/test/testing.py
@@ -207,7 +207,24 @@ def _block_unconditionally(db, reason):
return function_named(maybe, fn_name)
return decorate
-
+def only_on(db, reason):
+ carp = _should_carp_about_exclusion(reason)
+ spec = db_spec(db)
+ def decorate(fn):
+ fn_name = fn.__name__
+ def maybe(*args, **kw):
+ if spec(config.db):
+ return fn(*args, **kw)
+ else:
+ msg = "'%s' unsupported on DB implementation '%s+%s': %s" % (
+ fn_name, config.db.name, config.db.driver, reason)
+ print msg
+ if carp:
+ print >> sys.stderr, msg
+ return True
+ return function_named(maybe, fn_name)
+ return decorate
+
def exclude(db, op, spec, reason):
"""Mark a test as unsupported by specific database server versions.