diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-11-15 16:58:50 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-12-11 13:26:05 -0500 |
| commit | ba5cbf9366e9b2c5ed8e27e91815d7a2c3b63e41 (patch) | |
| tree | 038f2263d581d5e49d74731af68febc4bf64eb19 /test/sql/test_query.py | |
| parent | 87d58b6d8188ccff808b3207d5f9398bb9adf9b9 (diff) | |
| download | sqlalchemy-ba5cbf9366e9b2c5ed8e27e91815d7a2c3b63e41.tar.gz | |
correct for "autocommit" deprecation warning
Ensure no autocommit warnings occur internally or
within tests.
Also includes fixes for SQL Server full text tests
which apparently have not been working at all for a long
time, as it used long removed APIs. CI has not had
fulltext running for some years and is now installed.
Change-Id: Id806e1856c9da9f0a9eac88cebc7a94ecc95eb96
Diffstat (limited to 'test/sql/test_query.py')
| -rw-r--r-- | test/sql/test_query.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 7d05462ab..6d26f7975 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -84,7 +84,7 @@ class QueryTest(fixtures.TestBase): @engines.close_first def teardown(self): - with testing.db.connect() as conn: + with testing.db.begin() as conn: conn.execute(addresses.delete()) conn.execute(users.delete()) conn.execute(users2.delete()) @@ -878,21 +878,22 @@ class RequiredBindTest(fixtures.TablesTest): ) def _assert_raises(self, stmt, params): - assert_raises_message( - exc.StatementError, - "A value is required for bind parameter 'x'", - testing.db.execute, - stmt, - **params - ) + with testing.db.connect() as conn: + assert_raises_message( + exc.StatementError, + "A value is required for bind parameter 'x'", + conn.execute, + stmt, + **params + ) - assert_raises_message( - exc.StatementError, - "A value is required for bind parameter 'x'", - testing.db.execute, - stmt, - params, - ) + assert_raises_message( + exc.StatementError, + "A value is required for bind parameter 'x'", + conn.execute, + stmt, + params, + ) def test_insert(self): stmt = self.tables.foo.insert().values( @@ -953,7 +954,7 @@ class LimitTest(fixtures.TestBase): ) metadata.create_all() - with testing.db.connect() as conn: + with testing.db.begin() as conn: conn.execute(users.insert(), user_id=1, user_name="john") conn.execute( addresses.insert(), address_id=1, user_id=1, address="addr1" @@ -1105,7 +1106,7 @@ class CompoundTest(fixtures.TestBase): ) metadata.create_all() - with testing.db.connect() as conn: + with testing.db.begin() as conn: conn.execute( t1.insert(), [ @@ -1470,7 +1471,7 @@ class JoinTest(fixtures.TestBase): metadata.drop_all() metadata.create_all() - with testing.db.connect() as conn: + with testing.db.begin() as conn: # t1.10 -> t2.20 -> t3.30 # t1.11 -> t2.21 # t1.12 @@ -1823,7 +1824,7 @@ class OperatorTest(fixtures.TestBase): ) metadata.create_all() - with testing.db.connect() as conn: + with testing.db.begin() as conn: conn.execute( flds.insert(), [dict(intcol=5, strcol="foo"), dict(intcol=13, strcol="bar")], |
