summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index fb41e51..3bb2746 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -23,7 +23,9 @@ class TestInputStream(unittest.TestCase):
def testReadAsync(self):
def callback(stream, result):
- self.assertEquals(stream.read_finish(result), len("testing"))
+ read = stream.read_finish(result)
+ self.assertEquals(read, len("testing"))
+ stream.close()
loop.quit()
self.stream.read_async(10240, 0, None, callback)
@@ -31,6 +33,23 @@ class TestInputStream(unittest.TestCase):
loop = gobject.MainLoop()
loop.run()
+ def testReadAsyncError(self):
+ self.count = 0
+ def callback(stream, result):
+ self.count += 1
+ if self.count == 1:
+ return
+ self.assertRaises(gobject.GError, stream.read_finish, result)
+ loop.quit()
+
+ self.stream.read_async(10240, 0, None, callback)
+ self.stream.read_async(10240, 0, None, callback)
+
+ loop = gobject.MainLoop()
+ loop.run()
+
+ self.assertEquals(self.count, 2)
+
class TestOutputStream(unittest.TestCase):
def setUp(self):