elif self.run_create_tables == "each":
drop_all_tables_from_metadata(self._tables_metadata, self.bind)
+ savepoints = getattr(config.requirements, "savepoints", False)
+ if savepoints:
+ savepoints = savepoints.enabled
+
# no need to run deletes if tables are recreated on setup
if (
self.run_define_tables != "each"
]
):
try:
- conn.execute(table.delete())
+ if savepoints:
+ with conn.begin_nested():
+ conn.execute(table.delete())
+ else:
+ conn.execute(table.delete())
except sa.exc.DBAPIError as ex:
print(
("Error emptying table %s: %r" % (table, ex)),
oracle =
cx_oracle>=7
postgresql = psycopg2>=2.7
-postgresql_pg8000 = pg8000>=1.16.6,<1.29
+postgresql_pg8000 = pg8000>=1.16.6,!=1.29.0
postgresql_asyncpg =
%(asyncio)s
asyncpg
with testing.expect_warnings("nested transaction already"):
s1.rollback() # no error (though it warns)
- t1.commit() # no error
+ # this test was previously calling "commit", but note relies on
+ # buggy behavior in PostgreSQL as the transaction block is in fact
+ # aborted. pg8000 enforces this on the client as of 1.29
+ t1.rollback() # no error
@testing.requires.savepoints_w_release
def test_savepoint_release_fails_flat(self):
assert not s1.is_active
s1.rollback() # no error. prior to 1.4 this would try to rollback
- t1.commit() # no error
+ # this test was previously calling "commit", but note relies on
+ # buggy behavior in PostgreSQL as the transaction block is in fact
+ # aborted. pg8000 enforces this on the client as of 1.29
+ t1.rollback() # no error
@testing.requires.savepoints_w_release
def test_savepoint_release_fails_ctxmanager(self, local_connection):