summaryrefslogtreecommitdiff
path: root/test/sql/test_delete.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-11-15 16:58:50 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-11 13:26:05 -0500
commitba5cbf9366e9b2c5ed8e27e91815d7a2c3b63e41 (patch)
tree038f2263d581d5e49d74731af68febc4bf64eb19 /test/sql/test_delete.py
parent87d58b6d8188ccff808b3207d5f9398bb9adf9b9 (diff)
downloadsqlalchemy-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_delete.py')
-rw-r--r--test/sql/test_delete.py62
1 files changed, 30 insertions, 32 deletions
diff --git a/test/sql/test_delete.py b/test/sql/test_delete.py
index 934022560..6f7b3f8f5 100644
--- a/test/sql/test_delete.py
+++ b/test/sql/test_delete.py
@@ -308,32 +308,31 @@ class DeleteFromRoundTripTest(fixtures.TablesTest):
)
@testing.requires.delete_from
- def test_exec_two_table(self):
+ def test_exec_two_table(self, connection):
users, addresses = self.tables.users, self.tables.addresses
dingalings = self.tables.dingalings
- with testing.db.connect() as conn:
- conn.execute(dingalings.delete()) # fk violation otherwise
+ connection.execute(dingalings.delete()) # fk violation otherwise
- conn.execute(
- addresses.delete()
- .where(users.c.id == addresses.c.user_id)
- .where(users.c.name == "ed")
- )
+ connection.execute(
+ addresses.delete()
+ .where(users.c.id == addresses.c.user_id)
+ .where(users.c.name == "ed")
+ )
- expected = [
- (1, 7, "x", "jack@bean.com"),
- (5, 9, "x", "fred@fred.com"),
- ]
- self._assert_table(addresses, expected)
+ expected = [
+ (1, 7, "x", "jack@bean.com"),
+ (5, 9, "x", "fred@fred.com"),
+ ]
+ self._assert_table(connection, addresses, expected)
@testing.requires.delete_from
- def test_exec_three_table(self):
+ def test_exec_three_table(self, connection):
users = self.tables.users
addresses = self.tables.addresses
dingalings = self.tables.dingalings
- testing.db.execute(
+ connection.execute(
dingalings.delete()
.where(users.c.id == addresses.c.user_id)
.where(users.c.name == "ed")
@@ -341,34 +340,33 @@ class DeleteFromRoundTripTest(fixtures.TablesTest):
)
expected = [(2, 5, "ding 2/5")]
- self._assert_table(dingalings, expected)
+ self._assert_table(connection, dingalings, expected)
@testing.requires.delete_from
- def test_exec_two_table_plus_alias(self):
+ def test_exec_two_table_plus_alias(self, connection):
users, addresses = self.tables.users, self.tables.addresses
dingalings = self.tables.dingalings
- with testing.db.connect() as conn:
- conn.execute(dingalings.delete()) # fk violation otherwise
- a1 = addresses.alias()
- conn.execute(
- addresses.delete()
- .where(users.c.id == addresses.c.user_id)
- .where(users.c.name == "ed")
- .where(a1.c.id == addresses.c.id)
- )
+ connection.execute(dingalings.delete()) # fk violation otherwise
+ a1 = addresses.alias()
+ connection.execute(
+ addresses.delete()
+ .where(users.c.id == addresses.c.user_id)
+ .where(users.c.name == "ed")
+ .where(a1.c.id == addresses.c.id)
+ )
expected = [(1, 7, "x", "jack@bean.com"), (5, 9, "x", "fred@fred.com")]
- self._assert_table(addresses, expected)
+ self._assert_table(connection, addresses, expected)
@testing.requires.delete_from
- def test_exec_alias_plus_table(self):
+ def test_exec_alias_plus_table(self, connection):
users, addresses = self.tables.users, self.tables.addresses
dingalings = self.tables.dingalings
d1 = dingalings.alias()
- testing.db.execute(
+ connection.execute(
delete(d1)
.where(users.c.id == addresses.c.user_id)
.where(users.c.name == "ed")
@@ -376,8 +374,8 @@ class DeleteFromRoundTripTest(fixtures.TablesTest):
)
expected = [(2, 5, "ding 2/5")]
- self._assert_table(dingalings, expected)
+ self._assert_table(connection, dingalings, expected)
- def _assert_table(self, table, expected):
+ def _assert_table(self, connection, table, expected):
stmt = table.select().order_by(table.c.id)
- eq_(testing.db.execute(stmt).fetchall(), expected)
+ eq_(connection.execute(stmt).fetchall(), expected)