diff options
author | Johan Dahlin <johan@gnome.org> | 2008-07-26 10:46:49 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-26 10:46:49 +0000 |
commit | a0a89623f6ab41d78dcb8a9602387aca6657225a (patch) | |
tree | 3b2793322e00e219bbd051d5a06dae1272eab99a /tests | |
parent | 31c7971dcad9d8e02cb59fe603bc6d83bf035666 (diff) | |
download | pygobject-a0a89623f6ab41d78dcb8a9602387aca6657225a.tar.gz |
Add a new API for registering exceptions for a GError domain. Register a
2008-07-26 Johan Dahlin <johan@gnome.org>
* examples/gio/directory-async.py:
* gio/Makefile.am:
* gio/giomodule.c (init_gio):
* glib/pyglib.c (pyglib_error_check),
(pyglib_register_exception_for_domain):
* glib/pyglib.h:
* tests/test_gio.py:
Add a new API for registering exceptions for a GError domain.
Register a new exception for G_IO_ERROR, update tests
and examples to use the new exception.
svn path=/trunk/; revision=863
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gio.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index 128494f6..92ffb479 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -103,18 +103,21 @@ class TestFile(unittest.TestCase): try: try: retval = gfile.mount_enclosing_volume_finish(result) - except glib.GError, e: + except gio.Error, e: # If we run the tests too fast - if (e.domain == gio.ERROR and - e.code == gio.ERROR_ALREADY_MOUNTED): + if e.code == gio.ERROR_ALREADY_MOUNTED: print ('WARNING: testfile is already mounted, ' - 'skipping test') + 'skipping test') loop.quit() return raise self.failUnless(retval) finally: - mount = gfile.find_enclosing_mount() + try: + mount = gfile.find_enclosing_mount() + except gio.Error: + loop.quit() + return mount.unmount(unmount_done) mount_operation = gio.MountOperation() @@ -239,7 +242,7 @@ class TestInputStream(unittest.TestCase): self.count += 1 if self.count == 1: return - self.assertRaises(glib.GError, stream.read_finish, result) + self.assertRaises(gio.Error, stream.read_finish, result) finally: loop.quit() @@ -311,7 +314,7 @@ class TestOutputStream(unittest.TestCase): def callback(stream, result): self.assertEquals(result.get_op_res_gssize(), 0) try: - self.assertRaises(glib.GError, stream.write_finish, result) + self.assertRaises(gio.Error, stream.write_finish, result) finally: loop.quit() |