@@ -3381,27 +3381,29 @@ def test_state_deferred(self, uamqp_transport, *, servicebus_namespace=None, ser
33813381 @pytest .mark .parametrize ("uamqp_transport" , uamqp_transport_params , ids = uamqp_transport_ids )
33823382 @ArgPasser ()
33833383 def test_queue_complete_message_on_different_receiver (self , uamqp_transport , * , servicebus_namespace_connection_string = None , servicebus_queue = None , ** kwargs ):
3384- with ServiceBusClient .from_connection_string (
3385- servicebus_namespace_connection_string , uamqp_transport = uamqp_transport ) as sb_client :
3386- sender = sb_client .get_queue_sender (servicebus_queue .name )
3387- receiver1 = sb_client .get_queue_receiver (servicebus_queue .name )
3388- receiver2 = sb_client .get_queue_receiver (servicebus_queue .name )
3389-
3390- with sender , receiver1 , receiver2 :
3391- sender .send_messages ([ServiceBusMessage ('test' ) for _ in range (5 )])
3392- received_msgs = []
3393- # the amount of messages returned by receive call is not stable, especially in live tests
3394- # of different os platforms, this is why a while loop is used here to receive the specific
3395- # amount of message we want to receive
3396- while len (received_msgs ) < 5 :
3397- # start receives on the first receiver and complete them on the other one.
3398- # the messages should settle over the management of the second receiver.
3399- for msg in receiver1 .receive_messages (max_message_count = 10 , max_wait_time = 5 ):
3400- receiver2 .complete_message (msg )
3401- received_msgs .append (msg )
3402-
3403- assert len (received_msgs ) == 5
3384+ # Skipping if uamqp: This bug will not be fixed in uamqp.
3385+ if not uamqp_transport :
3386+ with ServiceBusClient .from_connection_string (
3387+ servicebus_namespace_connection_string , uamqp_transport = uamqp_transport ) as sb_client :
3388+ sender = sb_client .get_queue_sender (servicebus_queue .name )
3389+ receiver1 = sb_client .get_queue_receiver (servicebus_queue .name )
3390+ receiver2 = sb_client .get_queue_receiver (servicebus_queue .name )
34043391
3405- messages_in_queue = receiver1 .peek_messages ()
3406-
3407- assert len (messages_in_queue ) == 0
3392+ with sender , receiver1 , receiver2 :
3393+ sender .send_messages ([ServiceBusMessage ('test' ) for _ in range (5 )])
3394+ received_msgs = []
3395+ # the amount of messages returned by receive call is not stable, especially in live tests
3396+ # of different os platforms, this is why a while loop is used here to receive the specific
3397+ # amount of message we want to receive
3398+ while len (received_msgs ) < 5 :
3399+ # start receives on the first receiver and complete them on the other one.
3400+ # the messages should settle over the management of the second receiver.
3401+ for msg in receiver1 .receive_messages (max_message_count = 10 , max_wait_time = 5 ):
3402+ receiver2 .complete_message (msg )
3403+ received_msgs .append (msg )
3404+
3405+ assert len (received_msgs ) == 5
3406+
3407+ messages_in_queue = receiver1 .peek_messages ()
3408+
3409+ assert len (messages_in_queue ) == 0
0 commit comments