diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-12-07 14:52:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-12-07 14:52:55 +0000 |
| commit | 1411f0bc4898737e3a575933e30c85a84b0bfb02 (patch) | |
| tree | 7c63a4e97c6066c410c08e8ba8c38e0df6d3e6d8 /test/engine | |
| parent | 0a5f0400b456ed4035a479f62d175e8b9361c46a (diff) | |
| parent | a845da8b0fc5bb172e278c399a1de9a2e49d62af (diff) | |
| download | sqlalchemy-1411f0bc4898737e3a575933e30c85a84b0bfb02.tar.gz | |
Merge "contextmanager skips rollback if trans says to skip it" into main
Diffstat (limited to 'test/engine')
| -rw-r--r-- | test/engine/test_transaction.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py index d47fa38c2..696391512 100644 --- a/test/engine/test_transaction.py +++ b/test/engine/test_transaction.py @@ -373,6 +373,36 @@ class TransactionTest(fixtures.TablesTest): result = connection.exec_driver_sql("select * from users") assert len(result.fetchall()) == 0 + @testing.requires.independent_connections + def test_no_rollback_in_deactive(self, local_connection): + """test #7388""" + + def fail(*arg, **kw): + raise BaseException("some base exception") + + with mock.patch.object(testing.db.dialect, "do_commit", fail): + with expect_raises_message(BaseException, "some base exception"): + with local_connection.begin(): + pass + + @testing.requires.independent_connections + @testing.requires.savepoints + def test_no_rollback_in_deactive_savepoint(self, local_connection): + """test #7388""" + + def fail(*arg, **kw): + raise BaseException("some base exception") + + with mock.patch.object( + testing.db.dialect, "do_release_savepoint", fail + ): + with local_connection.begin(): + with expect_raises_message( + BaseException, "some base exception" + ): + with local_connection.begin_nested(): + pass + @testing.requires.savepoints def test_nested_subtransaction_rollback(self, local_connection): connection = local_connection |
