)
cartitems.create()
-
+
+ @testbase.supported('postgres', 'oracle')
def testsequence(self):
cartitems.insert().execute(description='hi')
cartitems.insert().execute(description='there')
cartitems.select().execute().fetchall()
+ @testbase.supported('postgres', 'oracle')
def teststandalone(self):
s = Sequence("my_sequence", engine=db)
s.create()
finally:
s.drop()
+ @testbase.supported('postgres', 'oracle')
def teststandalone2(self):
x = cartitems.c.cart_id.sequence.execute()
self.assert_(1 <= x <= 4)
# 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
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
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)
def setUp(self):
objectstore.clear()
clear_mappers()
+
+ @testbase.unsupported('sqlite')
def testprimarykey(self):
class Entry(object):
pass
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
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):