From a7272201033bcbe8a19b33580088400420005aef Mon Sep 17 00:00:00 2001 From: Catalin Iacob Date: Fri, 15 Mar 2013 18:10:13 +0100 Subject: [PATCH] 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. --- tests/test_async.py | 3 +++ tests/test_connection.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tests/test_async.py b/tests/test_async.py index 08113c4..b51429f 100755 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -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) diff --git a/tests/test_connection.py b/tests/test_connection.py index e4b7d83..b3488f0 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -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) -- 1.8.1.5