[Telepathy-commits] [telepathy-gabble/master] Ensure we clean up after a raised assertion too

Sjoerd Simons sjoerd.simons at collabora.co.uk
Tue Aug 19 10:54:14 PDT 2008


20080730131805-b58c9-0044280ffe37363c76a647f9c0db62e148f64a08.gz
---
 tests/twisted/gabbletest.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index ab25e07..ade042e 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -312,18 +312,17 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
         fun(queue, bus, conn, stream)
     finally:
         try:
+            if colourer:
+              sys.stdout = colourer.fh
+            d = port.stopListening()
+            d.addBoth((lambda *args: reactor.crash()))
+
             conn.Disconnect()
             # second call destroys object
             conn.Disconnect()
         except dbus.DBusException, e:
             pass
 
-    if colourer:
-      sys.stdout = colourer.fh
-
-    d = port.stopListening()
-    d.addBoth((lambda *args: reactor.crash()))
-
 def exec_test(fun, params=None, protocol=None, timeout=None):
   reactor.callWhenRunning (exec_test_deferred, fun, params, protocol, timeout)
   reactor.run()
-- 
1.5.6.3




More information about the Telepathy-commits mailing list