Merge pull request #1105 from rafiss/with-block-connection-test

Handle failure in setup of ConnectionTwoPhaseTest
This commit is contained in:
Daniele Varrazzo 2020-05-30 04:43:26 +12:00 committed by GitHub
commit 779a1370ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -913,9 +913,11 @@ class ConnectionTwoPhaseTests(ConnectingTestCase):
cur.execute("DROP TABLE test_tpc;")
except psycopg2.ProgrammingError:
cnn.rollback()
cur.execute("CREATE TABLE test_tpc (data text);")
cnn.commit()
cnn.close()
try:
cur.execute("CREATE TABLE test_tpc (data text);")
cnn.commit()
finally:
cnn.close()
def count_xacts(self):
"""Return the number of prepared xacts currently in the test db."""