From: Mike Bayer Date: Mon, 26 Oct 2009 01:20:38 +0000 (+0000) Subject: oracle test fixes X-Git-Tag: rel_0_6beta1~219 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a7f889d8a99a228f4693cd6eaba896182d15408;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git oracle test fixes --- diff --git a/lib/sqlalchemy/test/schema.py b/lib/sqlalchemy/test/schema.py index 35b4060d2b..8f1df8734e 100644 --- a/lib/sqlalchemy/test/schema.py +++ b/lib/sqlalchemy/test/schema.py @@ -64,7 +64,7 @@ def Column(*args, **kw): if 'test_needs_autoincrement' in test_opts and \ kw.get('primary_key', False) and \ testing.against('firebird', 'oracle'): - def add_seq(tbl): + def add_seq(tbl, c): col._init_items( schema.Sequence(_truncate_name(testing.db.dialect, tbl.name + '_' + col.name + '_seq'), optional=True) ) diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index 0bf5a9259d..738f7f71fe 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -886,6 +886,7 @@ class HasSequenceTest(TestBase): @testing.requires.schemas @testing.requires.sequences + @testing.fails_on('oracle', "the 'scott' schema is the same as the default schema") def test_has_sequence_schema(self): test_schema = get_schema() s1 = sa.Sequence('user_id_seq', schema=test_schema) @@ -904,6 +905,7 @@ class HasSequenceTest(TestBase): # Tests related to engine.reflection def get_schema(): + # TODO: how to get multiple schemas in use on Oracle XE ? if testing.against('oracle'): return 'scott' return 'test_schema' diff --git a/test/orm/test_eager_relations.py b/test/orm/test_eager_relations.py index 397be9843f..a97c2fb242 100644 --- a/test/orm/test_eager_relations.py +++ b/test/orm/test_eager_relations.py @@ -847,10 +847,10 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL): @testing.resolve_artifact_names def test_inner_join_options(self): mapper(User, users, properties = dict( - orders =relation(Order, backref=backref('user', innerjoin=True)) + orders =relation(Order, backref=backref('user', innerjoin=True), order_by=orders.c.id) )) mapper(Order, orders, properties=dict( - items=relation(Item, secondary=order_items) + items=relation(Item, secondary=order_items, order_by=items.c.id) )) mapper(Item, items) sess = create_session() @@ -858,7 +858,7 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL): "SELECT users.id AS users_id, users.name AS users_name, orders_1.id AS orders_1_id, " "orders_1.user_id AS orders_1_user_id, orders_1.address_id AS orders_1_address_id, " "orders_1.description AS orders_1_description, orders_1.isopen AS orders_1_isopen " - "FROM users JOIN orders AS orders_1 ON users.id = orders_1.user_id" + "FROM users JOIN orders AS orders_1 ON users.id = orders_1.user_id ORDER BY orders_1.id" , use_default_dialect=True) self.assert_compile(sess.query(User).options(eagerload_all(User.orders, Order.items, innerjoin=True)), @@ -868,14 +868,15 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL): "orders_1.description AS orders_1_description, orders_1.isopen AS orders_1_isopen " "FROM users JOIN orders AS orders_1 ON users.id = orders_1.user_id JOIN order_items AS " "order_items_1 ON orders_1.id = order_items_1.order_id JOIN items AS items_1 ON " - "items_1.id = order_items_1.item_id" + "items_1.id = order_items_1.item_id ORDER BY orders_1.id, items_1.id" , use_default_dialect=True) def go(): eq_( sess.query(User).options( eagerload(User.orders, innerjoin=True), - eagerload(User.orders, Order.items, innerjoin=True)).all(), + eagerload(User.orders, Order.items, innerjoin=True)). + order_by(User.id).all(), [User(id=7, orders=[