diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-10-23 08:56:19 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-10-24 07:12:54 +0200 |
commit | 483c86267f2623eaa88d6a9e685c96ec3ba4f121 (patch) | |
tree | d7f69caae229776c8a571d05ce4df964bac6945d /tests/test_gobject.py | |
parent | 191cf45af44850fc29f2392ae2f0042aed6d13a9 (diff) | |
download | pygobject-483c86267f2623eaa88d6a9e685c96ec3ba4f121.tar.gz |
Mark GLib API that is exposed in GObject as deprecated
A lot of API in GObject really belongs into GLib and is just there for
historical/backwards compatible reasons. Mark these methods as deprecated so
that at some point we can drop them.
Diffstat (limited to 'tests/test_gobject.py')
-rw-r--r-- | tests/test_gobject.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/test_gobject.py b/tests/test_gobject.py index 82bdff98..0c23e304 100644 --- a/tests/test_gobject.py +++ b/tests/test_gobject.py @@ -2,6 +2,7 @@ import gc import unittest +import warnings from gi.repository import GObject import sys @@ -16,19 +17,22 @@ class TestGObjectAPI(unittest.TestCase): 'gi._gobject._gobject') def testCompatAPI(self): - # GObject formerly exposed a lot of GLib's functions - self.assertEqual(GObject.markup_escape_text('foo'), 'foo') + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + # GObject formerly exposed a lot of GLib's functions + self.assertEqual(GObject.markup_escape_text('foo'), 'foo') - def testMainContextAPI(self): - # backwards compatible alias API - ml = GObject.MainLoop() - self.assertFalse(ml.is_running()) + ml = GObject.MainLoop() + self.assertFalse(ml.is_running()) - context = GObject.main_context_default() - self.assertTrue(context.pending() in [False, True]) + context = GObject.main_context_default() + self.assertTrue(context.pending() in [False, True]) - context = GObject.MainContext() - self.assertFalse(context.pending()) + context = GObject.MainContext() + self.assertFalse(context.pending()) + + self.assertTrue(issubclass(w[0].category, DeprecationWarning)) + self.assertTrue('GLib.markup_escape_text' in str(w[0]), str(w[0])) self.assertLess(GObject.PRIORITY_HIGH, GObject.PRIORITY_DEFAULT) |