diff test/test_run.py @ 164:a68a4e22549c

Extend treepkg.run.call so that data can be fed to stdin of the subprocess.
author Bernhard Herzog <bh@intevation.de>
date Fri, 20 Jun 2008 14:06:27 +0000
parents e08b4b09d35f
children c7ac67366492
line wrap: on
line diff
--- a/test/test_run.py	Fri Jun 20 10:19:26 2008 +0000
+++ b/test/test_run.py	Fri Jun 20 14:06:27 2008 +0000
@@ -48,3 +48,16 @@
         else:
             # test OK
             pass
+
+    def test_call_inputdata(self):
+        """Test call with inputdata passed to the subprocesses stdin"""
+        # FIXME: If the feature being tested is not implemented
+        # properly, it's likely that the subprocess will wait
+        # indefinitely waiting for input.
+        data = "1"
+        subprocess_cmd = [sys.executable, "-c",
+                          "import sys; sys.exit(int(raw_input("")))"]
+        try:
+            call(subprocess_cmd, inputdata=data)
+        except SubprocessError, exc:
+            self.assertEquals(exc.returncode, 1)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)