From 71e7666cbbca810bf5d75ec16baab2864a110a28 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Sun, 9 Jan 2005 17:53:48 +0000 Subject: gobject.child_add_watch and gobject.spawn_async --- tests/Makefile.am | 1 + tests/test_subprocess.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/test_subprocess.py (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 64b8b46..2b68b3d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,7 @@ testhelper_la_SOURCES = \ test-unknown.c tests = \ + test_subprocess.py \ conversion.py \ enum.py \ gtype.py \ diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py new file mode 100644 index 0000000..189327d --- /dev/null +++ b/tests/test_subprocess.py @@ -0,0 +1,26 @@ +# -*- Mode: Python -*- + +import gc +import unittest +import sys + +from common import gobject + +class TestProcess(unittest.TestCase): + + def _child_watch_cb(self, pid, condition, data): + self.data = data + self.loop.quit() + + def testChildWatch(self): + self.data = None + self.loop = gobject.MainLoop() + argv = [sys.executable, '-c', 'import sys'] + pid, stdin, stdout, stderr = gobject.spawn_async( + argv, flags=gobject.SPAWN_DO_NOT_REAP_CHILD) + gobject.child_watch_add(pid, self._child_watch_cb, 12345) + self.loop.run() + self.assertEqual(self.data, 12345) + +if __name__ == '__main__': + unittest.main() -- cgit