telepathy-mission-control: account-manager/avatar.py: fix race condition by combining expect_many calls

Simon McVittie smcv at kemper.freedesktop.org
Tue Oct 29 15:50:48 CET 2013


Module: telepathy-mission-control
Branch: master
Commit: 4a68477e5e501dc5e5932e1326e36fe964cce940
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=4a68477e5e501dc5e5932e1326e36fe964cce940

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Oct 29 13:38:20 2013 +0000

account-manager/avatar.py: fix race condition by combining expect_many calls

The test account-storage plugin uses GDBus, so its signals have an
undefined order with respect to MC's dbus-glib signals. We don't
actually care about the order anyway, so expect them all in one
big expect_many call.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71001
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 tests/twisted/account-manager/avatar.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/twisted/account-manager/avatar.py b/tests/twisted/account-manager/avatar.py
index 8bae300..b31ab97 100644
--- a/tests/twisted/account-manager/avatar.py
+++ b/tests/twisted/account-manager/avatar.py
@@ -162,10 +162,8 @@ def test(q, bus, mc):
                 interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
                 signal='DeferringSetAttribute',
                 args=[account.object_path, 'AvatarMime', '']),
-            )
-    q.expect('dbus-signal', path=account.object_path,
-             interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged')
-    q.expect_many(
+            EventPattern('dbus-signal', path=account.object_path,
+                interface=cs.ACCOUNT_IFACE_AVATAR, signal='AvatarChanged'),
             EventPattern('dbus-signal',
                 interface=cs.TEST_DBUS_ACCOUNT_PLUGIN_IFACE,
                 signal='CommittingOne',



More information about the telepathy-commits mailing list