@@ -270,48 +270,6 @@ async def another_handler(event: AnotherEvent):
270270 assert not any ("Called handler another_handler" in msg for msg in log_messages )
271271
272272
273- @pytest .mark .asyncio
274- async def test_silent_suppresses_handler_logging (caplog ):
275- """Test that marking an event as silent suppresses the 'Called handler' log message."""
276- import logging
277-
278- manager = EventManager ()
279- manager .register (ValidEvent )
280- manager .register (AnotherEvent )
281-
282- handler_called = []
283-
284- @manager .subscribe
285- async def valid_handler (event : ValidEvent ):
286- handler_called .append ("valid" )
287-
288- @manager .subscribe
289- async def another_handler (event : AnotherEvent ):
290- handler_called .append ("another" )
291-
292- # Mark ValidEvent as silent
293- manager .silent (ValidEvent )
294-
295- # Capture logs at INFO level
296- with caplog .at_level (logging .INFO ):
297- # Send both events
298- manager .send (ValidEvent (field = 42 ))
299- manager .send (AnotherEvent (value = "test" ))
300- await manager .wait ()
301-
302- # Both handlers should have been called
303- assert handler_called == ["valid" , "another" ]
304-
305- # Check log messages
306- log_messages = [record .message for record in caplog .records ]
307-
308- # Should NOT see "Called handler" for ValidEvent (it's silent)
309- assert not any ("Called handler valid_handler" in msg and "custom.validevent" in msg for msg in log_messages )
310-
311- # SHOULD see "Called handler" for AnotherEvent (not silent)
312- assert any ("Called handler another_handler" in msg and "custom.anotherevent" in msg for msg in log_messages )
313-
314-
315273@pytest .mark .asyncio
316274@pytest .mark .integration
317275async def test_protobuf_events_with_base_event ():
0 commit comments