]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Don't commit failed transaction
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Oct 2017 01:17:00 +0000 (21:17 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Oct 2017 01:17:00 +0000 (21:17 -0400)
The test here commits even though integrityerror
was raised due to the fixture.  Postgresql seems to allow
this even though it's usually strict about this.  remove
the requirement that a database needs to be able to
commit after an integrity error was raised.

Change-Id: I437faadb04ff7a9c3f624c68646b4f4f504b504a

lib/sqlalchemy/testing/suite/test_dialect.py

index 5dd1f0501712e411c7d2b4b730bd49e0b3cedb5f..2c5dd0e36460ad296790d42c992d1312adfcd2be 100644 (file)
@@ -29,7 +29,9 @@ class ExceptionTest(fixtures.TablesTest):
     @requirements.duplicate_key_raises_integrity_error
     def test_integrity_error(self):
 
-        with config.db.begin() as conn:
+        with config.db.connect() as conn:
+
+            trans = conn.begin()
             conn.execute(
                 self.tables.manual_pk.insert(),
                 {'id': 1, 'data': 'd1'}
@@ -42,6 +44,8 @@ class ExceptionTest(fixtures.TablesTest):
                 {'id': 1, 'data': 'd1'}
             )
 
+            trans.rollback()
+
 
 class AutocommitTest(fixtures.TablesTest):