[gvfs] tests: Fix race condition in Drive tests



commit 5b96cf7d00194fa99dedf504c7e36e2e2ee80a28
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Feb 1 15:11:07 2013 +0100

    tests: Fix race condition in Drive tests
    
    In load_image(), process all pending main loop events to get an up to date
    volume monitor. Not doing that can cause tests to still see the temporarily
    added and removed device that was created for loading the image.

 test/gvfs-test |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index 9717215..5950088 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -930,6 +930,9 @@ class Drive(GvfsTestCase):
             time.sleep(0.2)
 
         # flush volume monitor output
+        ctx = GLib.MainContext().default()
+        while ctx.iteration(False):
+            pass
         self.monitor.stdout.readall()
 
     def setUp(self):



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