[Telepathy-commits] [telepathy-salut/master] test-two-muc-stream-tubes: break potential races

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Mar 11 06:39:31 PDT 2009


---
 tests/twisted/avahi/test-two-muc-stream-tubes.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tests/twisted/avahi/test-two-muc-stream-tubes.py b/tests/twisted/avahi/test-two-muc-stream-tubes.py
index 3966bdb..1c58e6a 100644
--- a/tests/twisted/avahi/test-two-muc-stream-tubes.py
+++ b/tests/twisted/avahi/test-two-muc-stream-tubes.py
@@ -249,14 +249,16 @@ def test(q, bus, conn):
 
     client_transport = e.transport
 
-    e = q.expect('dbus-signal', signal='StreamTubeNewConnection',
-        path=tubes1_path)
-    id, handle = e.args
+    sig, e = q.expect_many(
+        EventPattern('dbus-signal', signal='StreamTubeNewConnection',
+            path=tubes1_path),
+        EventPattern('client-data-received'))
+
+    id, handle = sig.args
     assert id == conn1_tube_id
     assert handle == contact2_handle_on_conn1
 
     # client receives server's welcome message
-    e = q.expect('client-data-received')
     assert e.data == SERVER_WELCOME_MSG
 
     client_transport.write(test_string)
@@ -442,13 +444,15 @@ def test(q, bus, conn):
 
     client_transport = e.transport
 
-    e = q.expect('dbus-signal', signal='StreamTubeNewConnection',
-        path=tube1_path)
-    handle = e.args[0]
+    sig, e = q.expect_many(
+        EventPattern('dbus-signal', signal='StreamTubeNewConnection',
+            path=tube1_path),
+        EventPattern('client-data-received'))
+
+    handle = sig.args[0]
     assert handle == contact2_handle_on_conn1
 
     # client receives server's welcome message
-    e = q.expect('client-data-received')
     assert e.data == SERVER_WELCOME_MSG
 
     client_transport.write(test_string)
-- 
1.5.6.5




More information about the telepathy-commits mailing list