[Telepathy-commits] [telepathy-gabble/master] Support for running multiple test functions inside one test

Senko Rasic senko at phyrexia.lan
Tue Dec 2 04:34:00 PST 2008


---
 tests/twisted/gabbletest.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index 5a0f630..6399657 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -318,7 +318,7 @@ def install_colourer():
     return sys.stdout
 
 
-def exec_test_deferred (fun, params, protocol=None, timeout=None):
+def exec_test_deferred (funs, params, protocol=None, timeout=None):
     # hack to ease debugging
     domish.Element.__repr__ = domish.Element.toXml
     colourer = None
@@ -337,11 +337,8 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
 
     error = None
 
-    if not isinstance(fun, list):
-        fun = [fun]
-
     try:
-        for f in fun:
+        for f in funs:
             conn = make_connection(bus, queue.append, params)
             f(queue, bus, conn, stream)
     except Exception, e:
@@ -369,10 +366,13 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None):
     except dbus.DBusException, e:
         pass
 
-def exec_test(fun, params=None, protocol=None, timeout=None):
-  reactor.callWhenRunning (exec_test_deferred, fun, params, protocol, timeout)
+def exec_tests(funs, params=None, protocol=None, timeout=None):
+  reactor.callWhenRunning (exec_test_deferred, funs, params, protocol, timeout)
   reactor.run()
 
+def exec_test(fun, params=None, protocol=None, timeout=None):
+  exec_tests([fun], params, protocol, timeout)
+
 # Useful routines for server-side vCard handling
 current_vcard = domish.Element(('vcard-temp', 'vCard'))
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list