[telepathy-mission-control/master] Improve robustness of waiting for the NormalizedName

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 1 07:24:32 PDT 2009


MC sometimes combines AccountPropertyChanged signals, so waiting for
one with particular arguments won't necessarily work.
---
 test/twisted/test-connect.py |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/test/twisted/test-connect.py b/test/twisted/test-connect.py
index d7d0765..67de520 100644
--- a/test/twisted/test-connect.py
+++ b/test/twisted/test-connect.py
@@ -107,11 +107,20 @@ def test(q, bus, mc):
                 path=conn.object_path, handled=True),
             )
 
-    # this secretly indicates that the TpConnection is ready
-    e = q.expect('dbus-signal',
-            interface=cs.ACCOUNT, signal='AccountPropertyChanged',
-            path=account.object_path,
-            args=[{'NormalizedName': 'myself'}])
+    # Wait for an AccountPropertyChanged signal that indicates that we have
+    # the NormalizedName for the Account; this secretly indicates that the
+    # TpConnection inside MC is ready.
+    #
+    # FIXME: we shouldn't have to wait for this, but if we don't, then the
+    # NewChannels signal isn't necessarily handled
+
+    while 1:
+        e = q.expect('dbus-signal',
+                interface=cs.ACCOUNT, signal='AccountPropertyChanged',
+                path=account.object_path)
+        if 'NormalizedName' in e.args[0]:
+            assert e.args[0]['NormalizedName'] == 'myself', e.args
+            break
 
     #e = q.expect('dbus-method-call', name='SetSelfCapabilities',
     #        path=conn.object_path)
-- 
1.5.6.5




More information about the telepathy-commits mailing list