From b90c01cff5ff5cb2796182f2ffd7b5248eaeed6a Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Mon, 28 Dec 2009 22:41:54 +0100 Subject: Wrap GIOStream.close_async() and add a test --- tests/test_gio.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/test_gio.py b/tests/test_gio.py index fd2edba..49d83e8 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -1072,3 +1072,24 @@ class TestBufferedInputStream(unittest.TestCase): loop = glib.MainLoop() loop.run() + +class TestIOStream(unittest.TestCase): + def setUp(self): + self.file = gio.File("file.txt") + self.iofile = self.file.create_readwrite(gio.FILE_CREATE_NONE) + + def tearDown(self): + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testIOStreamCloseAsync(self): + def callback(stream, result): + try: + self.failUnless(stream.close_finish(result)) + finally: + loop.quit() + + self.iofile.close_async(callback) + + loop = glib.MainLoop() + loop.run() -- cgit