[pygobject/pygobject-3-4] test_overrides_gtk: Ignore GVFS warnings from FileChooserDialog



commit c36e12368bb430ca1fb6eafd7d86f59c44965a31
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Nov 30 08:44:56 2012 +0100

    test_overrides_gtk: Ignore GVFS warnings from FileChooserDialog
    
    Do not cause GVFS warnings from Gtk.FileChooserDialog (which may concern
    unavailable monitor backends in the test environment) to fail the tests.

 tests/test_overrides_gtk.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index ee41457..23b532b 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -292,9 +292,15 @@ class TestGtk(unittest.TestCase):
         self.assertEqual('color selection dialog test', dialog.get_title())
 
         # Gtk.FileChooserDialog
-        dialog = Gtk.FileChooserDialog(title='file chooser dialog test',
-                                       buttons=('test-button1', 1),
-                                       action=Gtk.FileChooserAction.SAVE)
+        # might cause a GVFS warning, do not break on this
+        old_mask = GLib.log_set_always_fatal(
+            GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR)
+        try:
+            dialog = Gtk.FileChooserDialog(title='file chooser dialog test',
+                                           buttons=('test-button1', 1),
+                                           action=Gtk.FileChooserAction.SAVE)
+        finally:
+            GLib.log_set_always_fatal(old_mask)
         self.assertTrue(isinstance(dialog, Gtk.Dialog))
         self.assertTrue(isinstance(dialog, Gtk.Window))
 



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