diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-29 14:06:43 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-29 14:06:43 -0400 |
| commit | 83326bf44c590a3b22ddf9bf658f509d1491bc0f (patch) | |
| tree | 2f67a8167450d44753eb9cc2b2b3044decd3354d /test/dialect/postgresql | |
| parent | 405c223ae50e78dacac08783c414619db20df0b7 (diff) | |
| download | sqlalchemy-83326bf44c590a3b22ddf9bf658f509d1491bc0f.tar.gz | |
- The exception wrapping system for DBAPI errors can now accommodate
non-standard DBAPI exceptions, such as the psycopg2
TransactionRollbackError. These exceptions will now be raised
using the closest available subclass in ``sqlalchemy.exc``, in the
case of TransactionRollbackError, ``sqlalchemy.exc.OperationalError``.
fixes #3075
Diffstat (limited to 'test/dialect/postgresql')
| -rw-r--r-- | test/dialect/postgresql/test_dialect.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index 11b277b66..b751bbcdd 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -65,6 +65,16 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): assert testing.db.dialect.dbapi.__version__.\ startswith(".".join(str(x) for x in v)) + @testing.only_on('postgresql+psycopg2', 'psycopg2-specific feature') + def test_psycopg2_non_standard_err(self): + from psycopg2.extensions import TransactionRollbackError + import psycopg2 + + exception = exc.DBAPIError.instance( + "some statement", {}, TransactionRollbackError("foo"), + psycopg2.Error) + assert isinstance(exception, exc.OperationalError) + # currently not passing with pg 9.3 that does not seem to generate # any notices here, would rather find a way to mock this @testing.requires.no_coverage |
