diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2020-07-08 20:35:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 20:35:01 +0100 |
commit | cecff195fc17a83d593dd62c239aa188883a844e (patch) | |
tree | 54818d49c38eba5a8c32b271a4d193a619dd1fec | |
parent | 779a1370ceeac130de07edc0510f2c55846be1bd (diff) | |
parent | a61f30b2d26af134c89e040703d94239ea9a0bf6 (diff) | |
download | psycopg2-cecff195fc17a83d593dd62c239aa188883a844e.tar.gz |
Merge pull request #1127 from rafiss/iso-level-finally-block
Handle failure in setup of IsolationLevelsTestCase
-rwxr-xr-x | tests/test_connection.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test_connection.py b/tests/test_connection.py index 8236801..af2c3c4 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -567,9 +567,11 @@ class IsolationLevelsTestCase(ConnectingTestCase): cur.execute("drop table isolevel;") except psycopg2.ProgrammingError: conn.rollback() - cur.execute("create table isolevel (id integer);") - conn.commit() - conn.close() + try: + cur.execute("create table isolevel (id integer);") + conn.commit() + finally: + conn.close() def test_isolation_level(self): conn = self.connect() |