[Treepkg-commits] r48 - trunk/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu May 22 12:40:08 CEST 2008


Author: bh
Date: 2008-05-22 12:40:08 +0200 (Thu, 22 May 2008)
New Revision: 48

Added:
   trunk/test/test_run.py
Log:
Add tests for treepkg/run.py


Added: trunk/test/test_run.py
===================================================================
--- trunk/test/test_run.py	2008-05-22 09:58:57 UTC (rev 47)
+++ trunk/test/test_run.py	2008-05-22 10:40:08 UTC (rev 48)
@@ -0,0 +1,30 @@
+# Copyright (C) 2008 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh at intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+"""Tests for treepkg.run"""
+
+import sys
+import os
+import unittest
+
+from treepkg.run import call, SubprocessError
+
+
+
+class TestCall(unittest.TestCase):
+
+    def test_call_defaults(self):
+        call([sys.executable, "-c", "pass"])
+
+    def test_call_error(self):
+        """Test call with a subprocess that exits with a non-zero exit code"""
+        try:
+            call([sys.executable, "-c", "import sys; sys.exit(1)"])
+        except SubprocessError, exc:
+            self.assertEquals(exc.returncode, 1)
+        else:
+            self.fail("call did not raise an exception")


Property changes on: trunk/test/test_run.py
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native



More information about the Treepkg-commits mailing list