mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Fix tests for Postgres 9.3
Postgres 9.3 turns messages about implicit indexes and sequences from NOTICE to DEBUG1 so the tests fail with a default 9.3 server configuration because the client doesn't get any NOTICE. Fix it by also asking for DEBUG1 messages from the server when testing against Postgres >= 9.3.
This commit is contained in:
parent
7f86529183
commit
7abe1775d0
|
@ -429,6 +429,9 @@ class AsyncTests(unittest.TestCase):
|
|||
def test_notices(self):
|
||||
del self.conn.notices[:]
|
||||
cur = self.conn.cursor()
|
||||
if self.conn.server_version >= 90300:
|
||||
cur.execute("set client_min_messages=debug1")
|
||||
self.wait(cur)
|
||||
cur.execute("create temp table chatty (id serial primary key);")
|
||||
self.wait(cur)
|
||||
self.assertEqual("CREATE TABLE", cur.statusmessage)
|
||||
|
|
|
@ -79,6 +79,8 @@ class ConnectionTests(unittest.TestCase):
|
|||
def test_notices(self):
|
||||
conn = self.conn
|
||||
cur = conn.cursor()
|
||||
if self.conn.server_version >= 90300:
|
||||
cur.execute("set client_min_messages=debug1")
|
||||
cur.execute("create temp table chatty (id serial primary key);")
|
||||
self.assertEqual("CREATE TABLE", cur.statusmessage)
|
||||
self.assert_(conn.notices)
|
||||
|
@ -86,6 +88,8 @@ class ConnectionTests(unittest.TestCase):
|
|||
def test_notices_consistent_order(self):
|
||||
conn = self.conn
|
||||
cur = conn.cursor()
|
||||
if self.conn.server_version >= 90300:
|
||||
cur.execute("set client_min_messages=debug1")
|
||||
cur.execute("create temp table table1 (id serial); create temp table table2 (id serial);")
|
||||
cur.execute("create temp table table3 (id serial); create temp table table4 (id serial);")
|
||||
self.assertEqual(4, len(conn.notices))
|
||||
|
@ -97,6 +101,8 @@ class ConnectionTests(unittest.TestCase):
|
|||
def test_notices_limited(self):
|
||||
conn = self.conn
|
||||
cur = conn.cursor()
|
||||
if self.conn.server_version >= 90300:
|
||||
cur.execute("set client_min_messages=debug1")
|
||||
for i in range(0, 100, 10):
|
||||
sql = " ".join(["create temp table table%d (id serial);" % j for j in range(i, i+10)])
|
||||
cur.execute(sql)
|
||||
|
|
Loading…
Reference in New Issue
Block a user