[pygobject] Robustify test_glib.TestGLib.test_io_add_watch_pyfile



commit 263b9f97e748746e1d26847a82a4d6e53a42798a
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Nov 30 09:04:20 2012 +0100

    Robustify test_glib.TestGLib.test_io_add_watch_pyfile
    
    Use a longer timeout to avoid races on slow architectures, and cut the main
    loop as soon as we received all expected events.

 tests/test_glib.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/tests/test_glib.py b/tests/test_glib.py
index 5feae1f..9ef60e4 100644
--- a/tests/test_glib.py
+++ b/tests/test_glib.py
@@ -173,6 +173,9 @@ https://my.org/q?x=1&y=2
 
         def cb(file, condition):
             call_data.append((file, condition, file.readline()))
+            if len(call_data) == 2:
+                # avoid having to wait for the full timeout
+                ml.quit()
             return True
 
         # io_add_watch() takes an IOChannel, calling with a Python file is deprecated
@@ -182,7 +185,7 @@ https://my.org/q?x=1&y=2
             self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
 
         ml = GLib.MainLoop()
-        GLib.timeout_add(400, ml.quit)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         cmd.wait()



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