summaryrefslogtreecommitdiff
path: root/test/testlib
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2008-12-11 19:24:22 +0000
committerMichael Trier <mtrier@gmail.com>2008-12-11 19:24:22 +0000
commit052d7f36433a0c29ab20d0ea37933c03a488e12d (patch)
tree86f5e5c3438a32f0edfc89467a740f6e9038d45d /test/testlib
parent5b0c456abd7756fa50700b7332f2cbe1d5aef620 (diff)
downloadsqlalchemy-052d7f36433a0c29ab20d0ea37933c03a488e12d.tar.gz
Implemented experimental savepoint support in mssql. There are still some failing savepoint related tests.
Diffstat (limited to 'test/testlib')
-rw-r--r--test/testlib/requires.py5
-rw-r--r--test/testlib/testing.py24
2 files changed, 27 insertions, 2 deletions
diff --git a/test/testlib/requires.py b/test/testlib/requires.py
index 7b2d33beb..13d4cdf11 100644
--- a/test/testlib/requires.py
+++ b/test/testlib/requires.py
@@ -8,7 +8,8 @@ target database.
from testlib.testing import \
_block_unconditionally as no_support, \
_chain_decorators_on, \
- exclude
+ exclude, \
+ emits_warning_on
def deferrable_constraints(fn):
@@ -66,8 +67,8 @@ def savepoints(fn):
"""Target database must support savepoints."""
return _chain_decorators_on(
fn,
+ emits_warning_on('mssql', 'Savepoint support in mssql is experimental and may lead to data loss.'),
no_support('access', 'FIXME: guessing, needs confirmation'),
- no_support('mssql', 'FIXME: guessing, needs confirmation'),
no_support('sqlite', 'not supported by database'),
no_support('sybase', 'FIXME: guessing, needs confirmation'),
exclude('mysql', '<', (5, 0, 3), 'not supported by database'),
diff --git a/test/testlib/testing.py b/test/testlib/testing.py
index 0bf083bbd..ed7669be9 100644
--- a/test/testlib/testing.py
+++ b/test/testlib/testing.py
@@ -322,6 +322,30 @@ def emits_warning(*messages):
return _function_named(safe, fn.__name__)
return decorate
+def emits_warning_on(db, *warnings):
+ """Mark a test as emitting a warning on a specific dialect.
+
+ With no arguments, squelches all SAWarning failures. Or pass one or more
+ strings; these will be matched to the root of the warning description by
+ warnings.filterwarnings().
+ """
+ def decorate(fn):
+ def maybe(*args, **kw):
+ if isinstance(db, basestring):
+ if config.db.name != db:
+ return fn(*args, **kw)
+ else:
+ wrapped = emits_warning(*warnings)(fn)
+ return wrapped(*args, **kw)
+ else:
+ if not _is_excluded(*db):
+ return fn(*args, **kw)
+ else:
+ wrapped = emits_warning(*warnings)(fn)
+ return wrapped(*args, **kw)
+ return _function_named(maybe, fn.__name__)
+ return decorate
+
def uses_deprecated(*messages):
"""Mark a test as immune from fatal deprecation warnings.