telepathy-mission-control: servicetest: if expect() fails, log what was expected

Simon McVittie smcv at kemper.freedesktop.org
Wed Oct 2 06:15:42 PDT 2013


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Sep 30 13:07:25 2013 +0100

servicetest: if expect() fails, log what was expected

It's usually possible to derive it from the backtrace, but logging
the pattern (as expect_many() does) makes it quicker.

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

---

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

diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index c464d8f..821240b 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -197,7 +197,14 @@ class BaseEventQueue:
         t = time.time()
 
         while True:
-            event = self.wait([pattern.subqueue])
+            try:
+                event = self.wait([pattern.subqueue])
+            except TimeoutError:
+                self.log('timeout')
+                self.log('still expecting:')
+                self.log(' - %r' % pattern)
+                raise
+
             self._check_forbidden(event)
 
             if pattern.match(event):



More information about the telepathy-commits mailing list