@@ -26,16 +26,18 @@ async def test_success_broadcast(nats_urls: List[str], nats_subject: str) -> Non
2626 await broker .startup ()
2727 tasks = []
2828 for _ in range (10 ):
29- tasks .append (asyncio .wait_for ( asyncio . create_task (read_message (broker )), 1 ))
29+ tasks .append (asyncio .create_task (read_message (broker )))
3030
3131 sent_message = BrokerMessage (
3232 task_id = uuid .uuid4 ().hex ,
3333 task_name = "meme" ,
3434 message = b"some" ,
3535 labels = {},
3636 )
37+
3738 asyncio .create_task (broker .kick (sent_message ))
38- for received_message in await asyncio .gather (* tasks ):
39+
40+ for received_message in await asyncio .wait_for (asyncio .gather (* tasks ), timeout = 1 ):
3941 assert received_message == sent_message .message
4042
4143
@@ -45,7 +47,7 @@ async def test_success_queued(nats_urls: List[str], nats_subject: str) -> None:
4547 broker = NatsBroker (servers = nats_urls , subject = nats_subject , queue = uuid .uuid4 ().hex )
4648 await broker .startup ()
4749 reading_task = asyncio .create_task (
48- asyncio . wait_for ( read_message (broker ), timeout = 1 ),
50+ read_message (broker ),
4951 )
5052
5153 sent_message = BrokerMessage (
@@ -55,4 +57,4 @@ async def test_success_queued(nats_urls: List[str], nats_subject: str) -> None:
5557 labels = {},
5658 )
5759 asyncio .create_task (broker .kick (sent_message ))
58- assert await reading_task == sent_message .message
60+ assert await asyncio . wait_for ( reading_task , timeout = 1 ) == sent_message .message
0 commit comments