]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Make sure notices are enabled in test db
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 22 May 2020 16:52:38 +0000 (04:52 +1200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 22 May 2020 16:53:04 +0000 (04:53 +1200)
tests/pq/test_pgconn.py
tests/test_async_connection.py
tests/test_connection.py

index 892ec971f0ce0ae7444de2e6f04d8530081e908a..a0bafc6b11be35895ee0e5d571f47b508d6eedcd 100644 (file)
@@ -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"
index b7c3d726ad0f0275dfb9d62e4f498fa824ad68d3..272d6f0795476f772ef255a942ffc35c18088e88 100644 (file)
@@ -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(
index dc9fe43134ef2c141268ba21af6f8feb8e859dbc..7edea64dab734a6755936f4e6978755989c4627b 100644 (file)
@@ -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"