diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-10-22 13:38:23 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-10-23 05:52:20 +0200 |
commit | 15f7442bd0c45db25073e3d8494094f1c284ffa4 (patch) | |
tree | 3b49529f986407927e204eb433d49e8f0b806487 /tests/test_source.py | |
parent | b984a5fe0d065818a153f259db4dbde79534f084 (diff) | |
download | pygobject-15f7442bd0c45db25073e3d8494094f1c284ffa4.tar.gz |
Fix TestSource.testSources() test case
PyGObject has established the assumption that the destruction of a GLib.Source
Python object does not destroy the actual GSource, as shown in
TestSource.setup_timeout(), TestTimeout.test504337(), and
https://bugzilla.gnome.org/show_bug.cgi?id=504337.
So we need to explicitly destroy our MySource and Idle objects after using
them, as their callbacks always return True and we do not want them to spill
over into other tests.
Also fix the assertions to actually verify that MySources' callback was callied
(pos > 0, not pos >= 0), and use the unittest comparison API instead of a
simple assert statement.
https://bugzilla.gnome.org/show_bug.cgi?id=686627
Diffstat (limited to 'tests/test_source.py')
-rw-r--r-- | tests/test_source.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_source.py b/tests/test_source.py index fe674cd0..ec47d0ea 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -59,7 +59,13 @@ class TestSource(unittest.TestCase): loop.run() - assert self.pos >= 0 and idle.count >= 0 + m.destroy() + idle.destroy() + + self.assertGreater(self.pos, 0) + self.assertGreaterEqual(idle.count, 0) + self.assertTrue(m.is_destroyed()) + self.assertTrue(idle.is_destroyed()) def testSourcePrepare(self): # this test may not terminate if prepare() is wrapped incorrectly |