details:   https://code.tryton.org/tryton/commit/84d09dd9582b
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Fri Sep 04 11:53:57 2026 +0200
description:
        Wait until a message is received when testing subscription of bus

        Closes #15065
        (grafted from 020452568c782b3d20fe64fe58e33088095125a1)
diffstat:

 trytond/trytond/tests/test_bus.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (15 lines):

diff -r 21ace61117d9 -r 84d09dd9582b trytond/trytond/tests/test_bus.py
--- a/trytond/trytond/tests/test_bus.py Thu Sep 03 15:49:20 2026 +0200
+++ b/trytond/trytond/tests/test_bus.py Fri Sep 04 11:53:57 2026 +0200
@@ -126,8 +126,9 @@
             notify("Test", "Message", user=1)
             transaction.commit()
         # Let the listen thread registers the message
-        time.sleep(1)
-        response = Bus.subscribe(DB_NAME, ['user:1'])
+        while not (
+                response := Bus.subscribe(DB_NAME, ['user:1'])).get('message'):
+            time.sleep(.01)
 
         self.assertTrue(response['message'].pop('message_id'))
         self.assertEqual(response, {

Reply via email to