[telepathy-mission-control-5.16] telepathy-mission-control: tests: fix race condition in account-manager/avatar.py test

George Kiagiadakis gkiagia at kemper.freedesktop.org
Thu Sep 1 18:53:43 UTC 2016


Module: telepathy-mission-control
Branch: telepathy-mission-control-5.16
Commit: 6a93bfeab23d64216cb5084f2d63c18f12ab6844
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=6a93bfeab23d64216cb5084f2d63c18f12ab6844

Author: George Kiagiadakis <gkiagia at tolabaki.gr>
Date:   Thu Sep  1 21:19:34 2016 +0300

tests: fix race condition in account-manager/avatar.py test

It seems that the order of the dbus signals is unpredictable,
so requiring it in the test sometimes makes it fail. It also
seems that the other checks above in the same unit test have
the same logic of not expecting a certain order in signal emission,
so this is probably the right thing to do.

---

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

diff --git a/tests/twisted/account-manager/avatar.py b/tests/twisted/account-manager/avatar.py
index 9677e8a..353c899 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