[telepathy-gabble/master] expect_many(): log which events are still pending when a timeout occurs

Dafydd Harries dafydd.harries at collabora.co.uk
Mon Sep 21 06:53:13 PDT 2009


---
 tests/twisted/servicetest.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index 68ddc02..fd8d581 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -47,6 +47,9 @@ class EventPattern:
             del properties['predicate']
         self.properties = properties
 
+    def __repr__(self):
+        return 'EventPattern(%r, %r)' % (self.type, self.properties)
+
     def match(self, event):
         if event.type != self.type:
             return False
@@ -137,7 +140,15 @@ class BaseEventQueue:
         ret = [None] * len(patterns)
 
         while None in ret:
-            event = self.wait()
+            try:
+                event = self.wait()
+            except TimeoutError:
+                self.log('timeout')
+                self.log('still expecting:')
+                for i, pattern in enumerate(patterns):
+                    if ret[i] is None:
+                        self.log(' - %r' % pattern)
+                raise
             self.log_event(event)
             self._check_forbidden(event)
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list