[pygobject] tests: silence some glib deprecation warnings



commit a2b3d846fab3a4b660eefbe3555933afe6d9c90a
Author: Christoph Reiter <creiter src gnome org>
Date:   Sat Apr 1 18:06:47 2017 +0200

    tests: silence some glib deprecation warnings
    
    These functions were deprecated in the last few cycles.
    This hides the warnings when running the test suite.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780812

 tests/test_atoms.py         |    7 +++++--
 tests/test_overrides_gtk.py |    6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/tests/test_atoms.py b/tests/test_atoms.py
index 762f41e..e6c8aba 100644
--- a/tests/test_atoms.py
+++ b/tests/test_atoms.py
@@ -10,6 +10,8 @@ try:
 except (ValueError, ImportError):
     Gdk = None
 
+from helper import capture_glib_deprecation_warnings
+
 
 @unittest.skipUnless(Gdk, 'Gdk not available')
 class TestGdkAtom(unittest.TestCase):
@@ -79,8 +81,9 @@ class TestGdkAtom(unittest.TestCase):
                      "fails on OSX/Windows")
     def test_out_glist(self):
         display = Gdk.Display.get_default()
-        dm = display.get_device_manager()
-        device = dm.get_client_pointer()
+        with capture_glib_deprecation_warnings():
+            dm = display.get_device_manager()
+            device = dm.get_client_pointer()
         axes = device.list_axes()
         axes_names = [atom.name() for atom in axes]
         self.assertNotEqual(axes_names, [])
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index a683b70..591391e 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -9,7 +9,8 @@ import sys
 import warnings
 
 from compathelper import _unicode, _bytes
-from helper import ignore_gi_deprecation_warnings, capture_glib_warnings
+from helper import ignore_gi_deprecation_warnings, capture_glib_warnings, \
+    capture_glib_deprecation_warnings
 
 import gi
 import gi.overrides
@@ -1868,7 +1869,8 @@ class TestTextBuffer(unittest.TestCase):
         buffer.set_text('')
         buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello', tag)
         (start, end) = buffer.get_bounds()
-        self.assertTrue(start.begins_tag(tag))
+        with capture_glib_deprecation_warnings():
+            self.assertTrue(start.begins_tag(tag))
         self.assertTrue(start.has_tag(tag))
 
         buffer.set_text('')


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