From 6fccdf4a285d5332ef49f23dc18c3ce45501d78b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 4 Jan 2021 15:18:25 -0500 Subject: remove more bound metadata in Iae6ab95938a7e92b6d42086aec534af27b5577d3 I missed that the "bind" was being stuck onto the MetaData in TablesTest, which led thousands of ORM tests to still use bound metadata. Keep looking for bound metadata. standardize all ORM tests on a single means of getting a Session when the Session API isn't the thing we are directly testing, using a new function fixture_session() that replaces create_session() and uses modern defaults. Change-Id: Iaf71206e9ee568151496d8bc213a069504bf65ef --- test/sql/test_functions.py | 12 ++++-------- test/sql/test_query.py | 14 +++++++++++--- test/sql/test_sequences.py | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'test/sql') diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index 1722a1e69..91076f9c3 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -1064,14 +1064,10 @@ class ExecuteTest(fixtures.TestBase): @testing.fails_on_everything_except("postgresql") def test_as_from(self, connection): # TODO: shouldn't this work on oracle too ? - x = connection.execute(func.current_date(bind=testing.db)).scalar() - y = connection.execute( - func.current_date(bind=testing.db).select() - ).scalar() - z = connection.scalar(func.current_date(bind=testing.db)) - w = connection.scalar( - select("*").select_from(func.current_date(bind=testing.db)) - ) + x = connection.execute(func.current_date()).scalar() + y = connection.execute(func.current_date().select()).scalar() + z = connection.scalar(func.current_date()) + w = connection.scalar(select("*").select_from(func.current_date())) assert x == y == z == w diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 9af8ef6da..3047b5d09 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -264,15 +264,23 @@ class QueryTest(fixtures.TablesTest): def test_compiled_execute(self, connection): users = self.tables.users connection.execute(users.insert(), user_id=7, user_name="jack") - s = select(users).where(users.c.user_id == bindparam("id")).compile() + s = ( + select(users) + .where(users.c.user_id == bindparam("id")) + .compile(connection) + ) eq_(connection.execute(s, id=7).first()._mapping["user_id"], 7) def test_compiled_insert_execute(self, connection): users = self.tables.users connection.execute( - users.insert().compile(), user_id=7, user_name="jack" + users.insert().compile(connection), user_id=7, user_name="jack" + ) + s = ( + select(users) + .where(users.c.user_id == bindparam("id")) + .compile(connection) ) - s = select(users).where(users.c.user_id == bindparam("id")).compile() eq_(connection.execute(s, id=7).first()._mapping["user_id"], 7) def test_repeated_bindparams(self, connection): diff --git a/test/sql/test_sequences.py b/test/sql/test_sequences.py index b5ba28df7..65325aa6f 100644 --- a/test/sql/test_sequences.py +++ b/test/sql/test_sequences.py @@ -520,7 +520,7 @@ class SequenceAsServerDefaultTest( def test_drop_ordering(self): with self.sql_execution_asserter(testing.db) as asserter: - self.tables_test_metadata.drop_all(checkfirst=False) + self.tables_test_metadata.drop_all(testing.db, checkfirst=False) asserter.assert_( AllOf( -- cgit v1.2.1