[Telepathy-commits] [telepathy-gabble/master] gabbletest: make it possible for tests to fail again
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Aug 19 10:54:22 PDT 2008
20080730183555-53eee-105e1f87820b59bb5d91f36877b19e77414c2dee.gz
---
tests/twisted/gabbletest.py | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index ade042e..5a99e93 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -308,20 +308,28 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
conn = make_connection(bus, queue.append, params)
(stream, port) = make_stream(queue.append, protocol=protocol)
+ error = None
+
try:
fun(queue, bus, conn, stream)
- finally:
- try:
- if colourer:
- sys.stdout = colourer.fh
- d = port.stopListening()
- d.addBoth((lambda *args: reactor.crash()))
+ except Exception, e:
+ error = e
- conn.Disconnect()
- # second call destroys object
- conn.Disconnect()
- except dbus.DBusException, e:
- pass
+ try:
+ if colourer:
+ sys.stdout = colourer.fh
+ d = port.stopListening()
+ if error is None:
+ d.addBoth((lambda *args: reactor.crash()))
+ else:
+ # please ignore the POSIX behind the curtain
+ d.addBoth((lambda *args: os._exit(1)))
+
+ conn.Disconnect()
+ # second call destroys object
+ conn.Disconnect()
+ except dbus.DBusException, e:
+ pass
def exec_test(fun, params=None, protocol=None, timeout=None):
reactor.callWhenRunning (exec_test_deferred, fun, params, protocol, timeout)
--
1.5.6.3
More information about the Telepathy-commits
mailing list