summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/defaults.py5
-rw-r--r--test/inheritance.py2
-rw-r--r--test/objectstore.py8
-rw-r--r--test/selectresults.py6
-rw-r--r--test/testbase.py33
5 files changed, 50 insertions, 4 deletions
diff --git a/test/defaults.py b/test/defaults.py
index 096355826..8d848f4c5 100644
--- a/test/defaults.py
+++ b/test/defaults.py
@@ -131,7 +131,8 @@ class SequenceTest(PersistTest):
)
cartitems.create()
-
+
+ @testbase.supported('postgres', 'oracle')
def testsequence(self):
cartitems.insert().execute(description='hi')
cartitems.insert().execute(description='there')
@@ -140,6 +141,7 @@ class SequenceTest(PersistTest):
cartitems.select().execute().fetchall()
+ @testbase.supported('postgres', 'oracle')
def teststandalone(self):
s = Sequence("my_sequence", engine=db)
s.create()
@@ -149,6 +151,7 @@ class SequenceTest(PersistTest):
finally:
s.drop()
+ @testbase.supported('postgres', 'oracle')
def teststandalone2(self):
x = cartitems.c.cart_id.sequence.execute()
self.assert_(1 <= x <= 4)
diff --git a/test/inheritance.py b/test/inheritance.py
index 947844161..8b683b8ff 100644
--- a/test/inheritance.py
+++ b/test/inheritance.py
@@ -384,7 +384,9 @@ class InheritTest5(testbase.AssertMixin):
# shouldnt throw exception
products = mapper(Product, product, inherits=contents)
+
def testbackref(self):
+ """this test is currently known to fail in the 0.1 series of SQLAlchemy, pending the resolution of [ticket:154]"""
class ContentType(object): pass
class Content(object): pass
class Product(Content): pass
diff --git a/test/objectstore.py b/test/objectstore.py
index 4e61d08f0..9ec6ca7e2 100644
--- a/test/objectstore.py
+++ b/test/objectstore.py
@@ -143,7 +143,8 @@ class SessionTest(AssertMixin):
trans.commit()
self.assert_(name_of(7) != name1, msg="user_name should not be %s" % name1)
self.assert_(name_of(8) != name2, msg="user_name should not be %s" % name2)
-
+
+ @testbase.unsupported('sqlite')
def test_true_nested(self):
"""tests creating a new Session inside a database transaction, in
conjunction with an engine-level nested transaction, which uses
@@ -185,7 +186,8 @@ class VersioningTest(AssertMixin):
version_table.delete().execute()
objectstore.clear()
clear_mappers()
-
+
+ @testbase.unsupported('mysql')
def testbasic(self):
class Foo(object):pass
assign_mapper(Foo, version_table, version_id_col=version_table.c.version_id)
@@ -287,6 +289,8 @@ class PKTest(AssertMixin):
def setUp(self):
objectstore.clear()
clear_mappers()
+
+ @testbase.unsupported('sqlite')
def testprimarykey(self):
class Entry(object):
pass
diff --git a/test/selectresults.py b/test/selectresults.py
index 6a3d9dd4d..2e603580a 100644
--- a/test/selectresults.py
+++ b/test/selectresults.py
@@ -42,8 +42,14 @@ class SelectResultsTest(PersistTest):
assert self.res.count() == 100
assert self.res.filter(foo.c.bar<30).min(foo.c.bar) == 0
assert self.res.filter(foo.c.bar<30).max(foo.c.bar) == 29
+
+ @testbase.unsupported('mysql')
+ def test_aggregate_1(self):
# this one fails in mysql as the result comes back as a string
assert self.res.filter(foo.c.bar<30).sum(foo.c.bar) == 435
+
+ @testbase.unsupported('postgres', 'mysql')
+ def test_aggregate_2(self):
# this one fails with postgres, the floating point comparison fails
assert self.res.filter(foo.c.bar<30).avg(foo.c.bar) == 14.5
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):