[pygobject] tests: Add test for GLib.spawn_async_with_pipes()
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: Add test for GLib.spawn_async_with_pipes()
- Date: Sat, 23 Aug 2014 04:54:17 +0000 (UTC)
commit 6008748bd7ecc6e5c933e6902c77d8485b905a6f
Author: Simon Feltman <sfeltman src gnome org>
Date: Fri Aug 22 02:16:10 2014 -0700
tests: Add test for GLib.spawn_async_with_pipes()
https://bugzilla.gnome.org/show_bug.cgi?id=735213
tests/test_signal.py | 2 +-
tests/test_subprocess.py | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/tests/test_signal.py b/tests/test_signal.py
index b4c9082..21d17c5 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -765,7 +765,7 @@ class TestSignalDecorator(unittest.TestCase):
obj.emit('unnamed')
self.assertEqual(self.unnamedCalled, True)
- def NOtest_overridden_signal(self):
+ def test_overridden_signal(self):
# Test that the pushed signal is called in with super and the override
# which should both increment the "value" to 3
obj = self.DecoratedOverride()
diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py
index 6da8ad2..720c950 100644
--- a/tests/test_subprocess.py
+++ b/tests/test_subprocess.py
@@ -120,6 +120,23 @@ class TestProcess(unittest.TestCase):
self.assertEqual(out, b'hello world!\n')
self.assertEqual(err, b'')
+ def test_spawn_async_with_pipes(self):
+ res, pid, stdin, stdout, stderr = GLib.spawn_async_with_pipes(
+ working_directory=None,
+ argv=['cat'],
+ envp=None,
+ flags=GLib.SpawnFlags.SEARCH_PATH)
+
+ os.write(stdin, b'hello world!\n')
+ os.close(stdin)
+ out = os.read(stdout, 50)
+ os.close(stdout)
+ err = os.read(stderr, 50)
+ os.close(stderr)
+ GLib.spawn_close_pid(pid)
+ self.assertEqual(out, b'hello world!\n')
+ self.assertEqual(err, b'')
+
def test_spawn_async_envp(self):
pid, stdin, stdout, stderr = GLib.spawn_async(
['sh', '-c', 'echo $TEST_VAR'], ['TEST_VAR=moo!'],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]