mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Fixed handling of database disconnection in tests in green mode
This commit is contained in:
parent
e1ff432f4c
commit
594a4d79ec
|
@ -75,6 +75,9 @@ class ConnectionTests(unittest.TestCase):
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
try:
|
try:
|
||||||
cur.execute("select pg_terminate_backend(pg_backend_pid())")
|
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:
|
except psycopg2.OperationalError, e:
|
||||||
if e.pgcode != psycopg2.errorcodes.ADMIN_SHUTDOWN:
|
if e.pgcode != psycopg2.errorcodes.ADMIN_SHUTDOWN:
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in New Issue
Block a user