@@ -79,6 +79,9 @@ def listener1(*args):
79
79
80
80
class TestLogListeners (tb .ConnectedTestCase ):
81
81
82
+ @tb .with_connection_options (server_settings = {
83
+ 'client_min_messages' : 'notice'
84
+ })
82
85
async def test_log_listener_01 (self ):
83
86
q1 = asyncio .Queue (loop = self .loop )
84
87
@@ -90,19 +93,23 @@ def notice_callb(con, message):
90
93
91
94
async def raise_notice ():
92
95
await self .con .execute (
93
- "DO $$ BEGIN RAISE NOTICE 'catch me!'; END; $$ LANGUAGE plpgsql"
96
+ """DO $$
97
+ BEGIN RAISE NOTICE 'catch me!'; END;
98
+ $$ LANGUAGE plpgsql"""
94
99
)
95
100
96
101
async def raise_warning ():
97
102
await self .con .execute (
98
- "DO $$ BEGIN RAISE WARNING 'catch me!'; END; $$ LANGUAGE plpgsql"
103
+ """DO $$
104
+ BEGIN RAISE WARNING 'catch me!'; END;
105
+ $$ LANGUAGE plpgsql"""
99
106
)
100
107
101
108
con = self .con
102
109
con .add_log_listener (notice_callb )
103
110
104
111
expected_msg = {
105
- 'context' : 'PL/pgSQL function inline_code_block line 1 at RAISE' ,
112
+ 'context' : 'PL/pgSQL function inline_code_block line 2 at RAISE' ,
106
113
'message' : 'catch me!' ,
107
114
'server_source_filename' : 'pl_exec.c' ,
108
115
'server_source_function' : 'exec_stmt_raise' ,
@@ -151,6 +158,9 @@ async def raise_warning():
151
158
await raise_notice ()
152
159
self .assertTrue (q1 .empty ())
153
160
161
+ @tb .with_connection_options (server_settings = {
162
+ 'client_min_messages' : 'notice'
163
+ })
154
164
async def test_log_listener_02 (self ):
155
165
q1 = asyncio .Queue (loop = self .loop )
156
166
@@ -185,6 +195,9 @@ def notice_callb(con, message):
185
195
con .remove_log_listener (notice_callb )
186
196
self .assertTrue (q1 .empty ())
187
197
198
+ @tb .with_connection_options (server_settings = {
199
+ 'client_min_messages' : 'notice'
200
+ })
188
201
async def test_log_listener_03 (self ):
189
202
q1 = asyncio .Queue (loop = self .loop )
190
203
0 commit comments