From: Mike Bayer Date: Thu, 19 Oct 2017 01:17:00 +0000 (-0400) Subject: Don't commit failed transaction X-Git-Tag: rel_1_2_0~53^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1210f49bb5a691324a55b4c3bf4600c359f396a9;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Don't commit failed transaction 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 --- diff --git a/lib/sqlalchemy/testing/suite/test_dialect.py b/lib/sqlalchemy/testing/suite/test_dialect.py index 5dd1f05017..2c5dd0e364 100644 --- a/lib/sqlalchemy/testing/suite/test_dialect.py +++ b/lib/sqlalchemy/testing/suite/test_dialect.py @@ -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):