diff test/test_run.py @ 193:98de92b816d4

Add logfile argument to treepkg.run.call to log the output of the subprocess. Add a corresponding test case.
author Bernhard Herzog <bh@intevation.de>
date Thu, 31 Jul 2008 10:00:25 +0000
parents c7ac67366492
children e3ab8aca2b08
line wrap: on
line diff
--- a/test/test_run.py	Wed Jul 30 19:30:21 2008 +0000
+++ b/test/test_run.py	Thu Jul 31 10:00:25 2008 +0000
@@ -11,6 +11,8 @@
 import os
 import unittest
 
+from filesupport import FileTestMixin
+
 from treepkg.run import call, capture_output, SubprocessError
 
 
@@ -62,6 +64,16 @@
         except SubprocessError, exc:
             self.assertEquals(exc.returncode, 1)
 
+
+class TestRunWithLogging(unittest.TestCase, FileTestMixin):
+
+    def test_run_with_logfile(self):
+        logfilename = self.temp_file_name("logfile")
+        call([sys.executable, "-c", "print \"I'm a lumber jack and I'm OK\""],
+             logfile=logfilename)
+        self.checkFileContents(logfilename, "I'm a lumber jack and I'm OK\n")
+
+
 class TestCaptureOutput(unittest.TestCase):
 
     def test_capture_output_stdout(self):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)