[pygobject] gdbus tests: Fix hang if test case fails



commit 367e4ededd4a45125157050bcc9e4e685fd4a82d
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Fri Jul 8 10:15:53 2011 +0200

    gdbus tests: Fix hang if test case fails
    
    In the TestGDBusClient.test_native_calls_async() test case, the main loop was
    never quit when the call failed.

 tests/test_gdbus.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py
index 19fd76d..b5a8493 100644
--- a/tests/test_gdbus.py
+++ b/tests/test_gdbus.py
@@ -62,8 +62,10 @@ class TestGDBusClient(unittest.TestCase):
 
     def test_native_calls_async(self):
         def call_done(obj, result, user_data):
-            user_data['result'] = obj.call_finish(result)
-            user_data['main_loop'].quit()
+            try:
+                user_data['result'] = obj.call_finish(result)
+            finally:
+                user_data['main_loop'].quit()
 
         main_loop = gobject.MainLoop()
         data = {'main_loop': main_loop}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]