summaryrefslogtreecommitdiff
path: root/tests/test_gi.py
diff options
context:
space:
mode:
authorChristoph Reiter <creiter@src.gnome.org>2015-06-18 13:36:52 +0200
committerChristoph Reiter <creiter@src.gnome.org>2015-07-02 20:50:20 +0200
commitfea15145c2a3e6aac73350241a982a095e16c7d8 (patch)
tree24a94006c93409178457c8ab91ffd637c47fcd1a /tests/test_gi.py
parent619777730891b42b98da556c3aa9ca5a1b3f617b (diff)
downloadpygobject-fea15145c2a3e6aac73350241a982a095e16c7d8.tar.gz
tests: Silence various error messages and warnings.
This silences glib warnings which are due to testing of error handling, deprecation warnings which we ignore since we want to continue testing deprecated code and other error output of code which is supposed to fail. To reduce code duplication and make things easier this introduces a shared helper module containing various context managers and decorators which allow testing and silencing of warnings and errors. https://bugzilla.gnome.org/show_bug.cgi?id=751156
Diffstat (limited to 'tests/test_gi.py')
-rw-r--r--tests/test_gi.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py
index f69a61cc..4cdd1a42 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -24,6 +24,7 @@ from gi.repository import GObject, GLib, Gio
from gi.repository import GIMarshallingTests
from compathelper import _bytes, _unicode
+from helper import capture_exceptions
if sys.version_info < (3, 0):
CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8"
@@ -2305,7 +2306,10 @@ class TestPythonGObject(unittest.TestCase):
def test_exception_in_vfunc_return_value(self):
obj = self.ErrorObject()
- self.assertEqual(obj.vfunc_return_value_only(), 0)
+ with capture_exceptions() as exc:
+ self.assertEqual(obj.vfunc_return_value_only(), 0)
+ self.assertEqual(len(exc), 1)
+ self.assertEqual(exc[0].type, ValueError)
@unittest.skipUnless(hasattr(GIMarshallingTests, 'callback_owned_boxed'),
'requires newer version of GI')