From 594a4d79ece7de71ee10cd74957ef7baf699ca3b Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 16 Mar 2013 17:41:59 +0000 Subject: [PATCH] Fixed handling of database disconnection in tests in green mode --- tests/test_connection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index 76e83cf3..68de87ad 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -75,6 +75,9 @@ class ConnectionTests(unittest.TestCase): cur = conn.cursor() try: cur.execute("select pg_terminate_backend(pg_backend_pid())") + except psycopg2.DatabaseError, e: + # curiously in green mode we get a DatabaseError without pgcode + pass except psycopg2.OperationalError, e: if e.pgcode != psycopg2.errorcodes.ADMIN_SHUTDOWN: raise