[telepathy-mission-control/master] mctest: hopefully improve clarity, by moving shutdown actions out of a try/except block

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 1 09:43:30 PDT 2009


---
 test/twisted/mctest.py |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/test/twisted/mctest.py b/test/twisted/mctest.py
index 9770a1e..35000bc 100644
--- a/test/twisted/mctest.py
+++ b/test/twisted/mctest.py
@@ -74,9 +74,6 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
         error = e
 
     try:
-        if colourer:
-          sys.stdout = colourer.fh
-
         am_props_iface = dbus.Interface(bus.get_object(cs.AM, cs.AM_PATH),
                 cs.PROPERTIES_IFACE)
         am_props = am_props_iface.GetAll(cs.AM)
@@ -87,15 +84,18 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
                     cs.ACCOUNT)
             account_iface.Remove()
 
-        if error is None:
-          reactor.callLater(0, reactor.stop)
-        else:
-          # please ignore the POSIX behind the curtain
-          os._exit(1)
-
     except dbus.DBusException, e:
         pass
 
+    if error is None:
+      reactor.callLater(0, reactor.stop)
+    else:
+      # please ignore the POSIX behind the curtain
+      os._exit(1)
+
+    if colourer:
+      sys.stdout = colourer.fh
+
 def exec_test(fun, params=None, protocol=None, timeout=None):
   reactor.callWhenRunning (exec_test_deferred, fun, params, protocol, timeout)
   reactor.run()
-- 
1.5.6.5




More information about the telepathy-commits mailing list