summaryrefslogtreecommitdiffstats
path: root/tests/test_subprocess.py
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gjc@src.gnome.org>2005-01-09 17:53:48 +0000
committerGustavo J. A. M. Carneiro <gjc@src.gnome.org>2005-01-09 17:53:48 +0000
commit71e7666cbbca810bf5d75ec16baab2864a110a28 (patch)
treeccc6ed4c97fc695a97022509fde211f6cbc28072 /tests/test_subprocess.py
parentcdbddaa4d040be8b71d0e3b4790da4aaf6b87ab6 (diff)
downloadpygobject-71e7666cbbca810bf5d75ec16baab2864a110a28.tar.gz
pygobject-71e7666cbbca810bf5d75ec16baab2864a110a28.tar.xz
pygobject-71e7666cbbca810bf5d75ec16baab2864a110a28.zip
gobject.child_add_watch and gobject.spawn_async
Diffstat (limited to 'tests/test_subprocess.py')
-rw-r--r--tests/test_subprocess.py26
1 files changed, 26 insertions, 0 deletions
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()