@@ -484,22 +484,21 @@ def test_wait_next_messages(acfactory) -> None:
484484 # There are no old messages and the call returns immediately.
485485 assert not bot .wait_next_messages ()
486486
487- with concurrent .futures .ThreadPoolExecutor (max_workers = 1 ) as executor :
488- # Bot starts waiting for messages.
489- next_messages_task = executor .submit (bot .wait_next_messages )
487+ # Bot starts waiting for messages.
488+ next_messages_task = bot .wait_next_messages .future ()
490489
491- alice_contact_bot = alice .create_contact (bot , "Bot" )
492- alice_chat_bot = alice_contact_bot .create_chat ()
493- alice_chat_bot .send_text ("Hello!" )
490+ alice_contact_bot = alice .create_contact (bot , "Bot" )
491+ alice_chat_bot = alice_contact_bot .create_chat ()
492+ alice_chat_bot .send_text ("Hello!" )
494493
495- next_messages = next_messages_task . result ()
494+ next_messages = next_messages_task ()
496495
497- if len (next_messages ) == E2EE_INFO_MSGS :
498- next_messages += bot .wait_next_messages ()
496+ if len (next_messages ) == E2EE_INFO_MSGS :
497+ next_messages += bot .wait_next_messages ()
499498
500- assert len (next_messages ) == 1 + E2EE_INFO_MSGS
501- snapshot = next_messages [0 + E2EE_INFO_MSGS ].get_snapshot ()
502- assert snapshot .text == "Hello!"
499+ assert len (next_messages ) == 1 + E2EE_INFO_MSGS
500+ snapshot = next_messages [0 + E2EE_INFO_MSGS ].get_snapshot ()
501+ assert snapshot .text == "Hello!"
503502
504503
505504def test_import_export_backup (acfactory , tmp_path ) -> None :
0 commit comments