Mercurial > treepkg
comparison test/test_run.py @ 123:37aadd33ffab
Add tests for treepkg/run.py
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Thu, 22 May 2008 10:40:08 +0000 |
parents | |
children | e08b4b09d35f |
comparison
equal
deleted
inserted
replaced
122:6e34fc4ebe39 | 123:37aadd33ffab |
---|---|
1 # Copyright (C) 2008 by Intevation GmbH | |
2 # Authors: | |
3 # Bernhard Herzog <bh@intevation.de> | |
4 # | |
5 # This program is free software under the GPL (>=v2) | |
6 # Read the file COPYING coming with the software for details. | |
7 | |
8 """Tests for treepkg.run""" | |
9 | |
10 import sys | |
11 import os | |
12 import unittest | |
13 | |
14 from treepkg.run import call, SubprocessError | |
15 | |
16 | |
17 | |
18 class TestCall(unittest.TestCase): | |
19 | |
20 def test_call_defaults(self): | |
21 call([sys.executable, "-c", "pass"]) | |
22 | |
23 def test_call_error(self): | |
24 """Test call with a subprocess that exits with a non-zero exit code""" | |
25 try: | |
26 call([sys.executable, "-c", "import sys; sys.exit(1)"]) | |
27 except SubprocessError, exc: | |
28 self.assertEquals(exc.returncode, 1) | |
29 else: | |
30 self.fail("call did not raise an exception") |