diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-23 10:34:32 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-23 14:53:26 -0400 |
| commit | c0612f8166b7cd07895e7302bb59192abbb68c43 (patch) | |
| tree | ab8e6c5948ef23008789a49aa6128c1a3e7c0517 /lib/sqlalchemy/testing | |
| parent | 853f726454cff2f34c010cbafacfec85f51f8eeb (diff) | |
| download | sqlalchemy-c0612f8166b7cd07895e7302bb59192abbb68c43.tar.gz | |
enable pg8000 for 1.29.1 and above
ROLLBACK TO SAVEPOINT is re-enabled
in https://github.com/tlocke/pg8000/issues/111.
we still have to add savepoint support to our fixture that
deletes from tables without checking for them.
this is inconvenient but not incorrect.
Change-Id: I2f4a0a3e18db93c3e6794ade9b0fee33d2e4b7dc
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/fixtures.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py index d4e4d2dca..4b5366186 100644 --- a/lib/sqlalchemy/testing/fixtures.py +++ b/lib/sqlalchemy/testing/fixtures.py @@ -461,6 +461,10 @@ class TablesTest(TestBase): 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" @@ -478,7 +482,11 @@ class TablesTest(TestBase): ] ): 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)), |
