[pygobject/pygobject-2-28] gdbus tests: Fix hang if test case fails



commit 09d6cc2a6c857c7ef96432a279a853410718b150
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 a9442fe..ca4150a 100644
--- a/tests/test_gdbus.py
+++ b/tests/test_gdbus.py
@@ -67,8 +67,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]