diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-28 15:01:31 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-28 15:01:31 -0500 |
| commit | 8a1e619fb20df1be6ad2e0c563e451e17eb17628 (patch) | |
| tree | ba0d687981e3b079bc08de1a58d21514ce302d0b /test/engine | |
| parent | 086ad9ce6413e73f93506523d4eb8e23710443dc (diff) | |
| download | sqlalchemy-8a1e619fb20df1be6ad2e0c563e451e17eb17628.tar.gz | |
- revert the change first made in a6fe4dc, as we are now generalizing
the warning here to all safe_reraise() cases in Python 2.
- Revisiting :ticket:`2696`, first released in 1.0.10, which attempts to
work around Python 2's lack of exception context reporting by emitting
a warning for an exception that was interrupted by a second exception
when attempting to roll back the already-failed transaction; this
issue continues to occur for MySQL backends in conjunction with a
savepoint that gets unexpectedly lost, which then causes a
"no such savepoint" error when the rollback is attempted, obscuring
what the original condition was.
The approach has been generalized to the Core "safe
reraise" function which takes place across the ORM and Core in any
place that a transaction is being rolled back in response to an error
which occurred trying to commit, including the context managers
provided by :class:`.Session` and :class:`.Connection`, and taking
place for operations such as a failure on "RELEASE SAVEPOINT".
Previously, the fix was only in place for a specific path within
the ORM flush/commit process; it now takes place for all transational
context managers as well.
fixes #2696
Diffstat (limited to 'test/engine')
| -rw-r--r-- | test/engine/test_transaction.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py index 7f8a7c97c..c81a7580f 100644 --- a/test/engine/test_transaction.py +++ b/test/engine/test_transaction.py @@ -218,6 +218,27 @@ class TransactionTest(fixtures.TestBase): finally: connection.close() + @testing.requires.python2 + @testing.requires.savepoints_w_release + def test_savepoint_release_fails_warning(self): + with testing.db.connect() as connection: + connection.begin() + + with expect_warnings( + "An exception has occurred during handling of a previous " + "exception. The previous exception " + "is:.*..SQL\:.*RELEASE SAVEPOINT" + ): + def go(): + with connection.begin_nested() as savepoint: + connection.dialect.do_release_savepoint( + connection, savepoint._savepoint) + assert_raises_message( + exc.DBAPIError, + ".*SQL\:.*ROLLBACK TO SAVEPOINT", + go + ) + def test_retains_through_options(self): connection = testing.db.connect() try: |
