summaryrefslogtreecommitdiff
path: root/test/testbase.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-04-29 16:42:37 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-04-29 16:42:37 +0000
commitdeb80dbc7b1e0ec23c7eac6b1cd24799b1fb6b58 (patch)
treeb6f5da87a61a9f847939cacbab873b8bf6803696 /test/testbase.py
parent337d3b268562f421b6bb0e445c6f2ba187514a4b (diff)
downloadsqlalchemy-deb80dbc7b1e0ec23c7eac6b1cd24799b1fb6b58.tar.gz
added 'supports', 'unsupports' decorators to unittests so that they can all pass on all DBs
Diffstat (limited to 'test/testbase.py')
-rw-r--r--test/testbase.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/testbase.py b/test/testbase.py
index 923ed7de9..8ef63ef27 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -59,13 +59,44 @@ def parse_argv():
db = engine.create_engine(db_uri, echo=echo, default_ordering=True, **opts)
db = EngineAssert(db)
+def unsupported(*dbs):
+ """a decorator that marks a test as unsupported by one or more database implementations"""
+ def decorate(func):
+ name = db.name
+ for d in dbs:
+ if d == name:
+ def lala(self):
+ echo_text("'" + func.__name__ + "' unsupported on DB implementation '" + name + "'")
+ lala.__name__ = func.__name__
+ return lala
+ else:
+ return func
+ return decorate
+
+def supported(*dbs):
+ """a decorator that marks a test as supported by one or more database implementations"""
+ def decorate(func):
+ name = db.name
+ for d in dbs:
+ if d == name:
+ return func
+ else:
+ def lala(self):
+ echo_text("'" + func.__name__ + "' unsupported on DB implementation '" + name + "'")
+ lala.__name__ = func.__name__
+ return lala
+ return decorate
+
+def echo_text(text):
+ print text
+
class PersistTest(unittest.TestCase):
"""persist base class, provides default setUpAll, tearDownAll and echo functionality"""
def __init__(self, *args, **params):
unittest.TestCase.__init__(self, *args, **params)
def echo(self, text):
if echo:
- print text
+ echo_text(text)
def setUpAll(self):
pass
def tearDownAll(self):