@@ -287,30 +287,30 @@ def test_producer_bool_value():
287287
288288def test_callback_exception_no_system_error ():
289289 delivery_reports = []
290-
290+
291291 def delivery_cb_that_raises (err , msg ):
292292 """Delivery report callback that raises an exception"""
293293 delivery_reports .append ((err , msg ))
294294 raise RuntimeError ("Test exception from delivery_cb" )
295-
295+
296296 producer = Producer ({
297297 'bootstrap.servers' : 'nonexistent-broker:9092' , # Will cause delivery failures
298298 'socket.timeout.ms' : 100 ,
299299 'message.timeout.ms' : 10 , # Very short timeout to trigger delivery failure quickly
300300 'on_delivery' : delivery_cb_that_raises
301301 })
302-
302+
303303 # Produce a message - this will trigger delivery report callback when it fails
304304 producer .produce ('test-topic' , value = 'test-message' )
305-
305+
306306 # Flush to ensure delivery reports are processed
307- # Before fix: Would get RuntimeError + SystemError
307+ # Before fix: Would get RuntimeError + SystemError
308308 # After fix: Should only get RuntimeError (no SystemError)
309309 with pytest .raises (RuntimeError ) as exc_info :
310310 producer .flush (timeout = 2.0 ) # Longer timeout to ensure delivery callback fires
311-
311+
312312 # Verify we got an exception from our callback
313313 assert "Test exception from delivery_cb" in str (exc_info .value )
314-
314+
315315 # Verify the delivery callback was actually called
316316 assert len (delivery_reports ) > 0
0 commit comments