def test_stmt_exception_pickleable_no_dbapi(self):
self._test_stmt_exception_pickleable(Exception("hello world"))
- @testing.fails_on("postgresql+psycopg2",
- "Packages the cursor in the exception")
+ @testing.crashes("postgresql+psycopg2",
+ "Older versions dont support cursor pickling, newer ones do")
@testing.fails_on("mysql+oursql",
"Exception doesn't come back exactly the same from pickle")
@testing.fails_on("oracle+cx_oracle",
from test.lib.util import function_named
from test.lib import fixtures
from test.orm import _fixtures
+from test.lib.testing import eq_
from test.lib.schema import Table, Column
class ABCTest(fixtures.MappedTest):
#for obj in sess.query(A).all():
# print obj
- assert [
+ eq_(
+ [
A(adata='a1'),
B(bdata='b1', adata='b1'),
B(bdata='b2', adata='b2'),
C(cdata='c1', bdata='c1', adata='c1'),
C(cdata='c2', bdata='c2', adata='c2'),
C(cdata='c2', bdata='c2', adata='c2'),
- ] == sess.query(A).order_by(A.id).all()
+ ], sess.query(A).order_by(A.id).all())
- assert [
+ eq_([
B(bdata='b1', adata='b1'),
B(bdata='b2', adata='b2'),
B(bdata='b3', adata='b3'),
C(cdata='c1', bdata='c1', adata='c1'),
C(cdata='c2', bdata='c2', adata='c2'),
C(cdata='c2', bdata='c2', adata='c2'),
- ] == sess.query(B).all()
+ ], sess.query(B).order_by(A.id).all())
- assert [
+ eq_([
C(cdata='c1', bdata='c1', adata='c1'),
C(cdata='c2', bdata='c2', adata='c2'),
C(cdata='c2', bdata='c2', adata='c2'),
- ] == sess.query(C).all()
+ ], sess.query(C).order_by(A.id).all())
test_roundtrip = function_named(
test_roundtrip, 'test_%s' % fetchtype)
sess = create_session()
for q in [
- sess.query(Address).filter(Address.id.in_([1, 4, 5])),
- sess.query(Address).filter(Address.id.in_([1, 4, 5])).limit(3)
+ sess.query(Address).filter(Address.id.in_([1, 4, 5])).order_by(Address.id),
+ sess.query(Address).filter(Address.id.in_([1, 4, 5])).order_by(Address.id).limit(3)
]:
sess.expunge_all()
eq_(q.all(),
sa.orm.clear_mappers()
mapper(User, users, properties={
- 'addresses':relationship(Address, lazy='joined')})
+ 'addresses':relationship(Address, lazy='joined',
+ order_by=addresses.c.id)})
mapper(Address, addresses, properties={
'user_id':deferred(addresses.c.user_id),
'dingalings':relationship(Dingaling, lazy='joined')})