From: Daniele Varrazzo Date: Fri, 22 May 2020 16:52:38 +0000 (+1200) Subject: Make sure notices are enabled in test db X-Git-Tag: 3.0.dev0~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87381464923b234ecd40acc67a8e1534e4981409;p=thirdparty%2Fpsycopg.git Make sure notices are enabled in test db --- diff --git a/tests/pq/test_pgconn.py b/tests/pq/test_pgconn.py index 892ec971f..a0bafc6b1 100644 --- a/tests/pq/test_pgconn.py +++ b/tests/pq/test_pgconn.py @@ -332,6 +332,7 @@ def test_make_empty_result(pq, pgconn): def test_notice_nohandler(pq, pgconn): + pgconn.exec_(b"set client_min_messages to notice") res = pgconn.exec_( b"do $$begin raise notice 'hello notice'; end$$ language plpgsql" ) @@ -345,6 +346,7 @@ def test_notice(pq, pgconn): assert res.status == pq.ExecStatus.NONFATAL_ERROR msgs.append(res.error_field(pq.DiagnosticField.MESSAGE_PRIMARY)) + pgconn.exec_(b"set client_min_messages to notice") pgconn.notice_handler = callback res = pgconn.exec_( b"do $$begin raise notice 'hello notice'; end$$ language plpgsql" @@ -360,6 +362,7 @@ def test_notice_error(pq, pgconn, caplog): def callback(res): raise Exception("hello error") + pgconn.exec_(b"set client_min_messages to notice") pgconn.notice_handler = callback res = pgconn.exec_( b"do $$begin raise notice 'hello notice'; end$$ language plpgsql" diff --git a/tests/test_async_connection.py b/tests/test_async_connection.py index b7c3d726a..272d6f079 100644 --- a/tests/test_async_connection.py +++ b/tests/test_async_connection.py @@ -236,6 +236,7 @@ def test_notice_handlers(aconn, loop, caplog): lambda diag: severities.append(diag.severity_nonlocalized) ) + aconn.pgconn.exec_(b"set client_min_messages to notice") cur = aconn.cursor() loop.run_until_complete( cur.execute( diff --git a/tests/test_connection.py b/tests/test_connection.py index dc9fe4313..7edea64da 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -226,6 +226,7 @@ def test_notice_handlers(conn, caplog): lambda diag: severities.append(diag.severity_nonlocalized) ) + conn.pgconn.exec_(b"set client_min_messages to notice") cur = conn.cursor() cur.execute( "do $$begin raise notice 'hello notice'; end$$ language plpgsql"