summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-10-27 15:16:09 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-10-27 22:27:18 -0700
commit1c03ebba9598e7b6d5293889f46b015bfac3611c (patch)
tree2188996ba7b9979e48b7058a08970a6131098c2e
parentac776da7e56b78a2fa422487f0ef0d8771bcb78f (diff)
downloadpygobject-1c03ebba9598e7b6d5293889f46b015bfac3611c.tar.gz
tests: Fix source testing to handle critical with non-existing sources
Silence new critical coming from g_source_remove on non-existing sources. This function still returns False, but we need to silence the new critical so the test suite doesn't fail. See bug 710724. https://bugzilla.gnome.org/show_bug.cgi?id=710978
-rw-r--r--tests/test_source.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index d0e28e4e..6f69927b 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -128,13 +128,19 @@ class TestSource(unittest.TestCase):
def test_remove(self):
s = GLib.idle_add(dir)
self.assertEqual(GLib.source_remove(s), True)
- # s is now removed, should fail now
- self.assertEqual(GLib.source_remove(s), False)
- # accepts large source IDs (they are unsigned)
- self.assertEqual(GLib.source_remove(GObject.G_MAXINT32), False)
- self.assertEqual(GLib.source_remove(GObject.G_MAXINT32 + 1), False)
- self.assertEqual(GLib.source_remove(GObject.G_MAXUINT32), False)
+ # Removing sources not found cause critical
+ old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_ERROR)
+ try:
+ # s is now removed, should fail now
+ self.assertEqual(GLib.source_remove(s), False)
+
+ # accepts large source IDs (they are unsigned)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXINT32), False)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXINT32 + 1), False)
+ self.assertEqual(GLib.source_remove(GObject.G_MAXUINT32), False)
+ finally:
+ GLib.log_set_always_fatal(old_mask)
def test_recurse_property(self):
s = GLib.Idle()