summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index b26d40c..52f4d47 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -44,6 +44,22 @@ class ProcessTestCase(unittest.TestCase):
"import sys; sys.exit(47)"])
self.assertEqual(rc, 47)
+ def test_check_call_zero(self):
+ # check_call() function with zero return code
+ rc = subprocess.check_call([sys.executable, "-c",
+ "import sys; sys.exit(0)"])
+ self.assertEqual(rc, 0)
+
+ def test_check_call_nonzero(self):
+ # check_call() function with non-zero return code
+ try:
+ subprocess.check_call([sys.executable, "-c",
+ "import sys; sys.exit(47)"])
+ except subprocess.CalledProcessError, e:
+ self.assertEqual(e.errno, 47)
+ else:
+ self.fail("Expected CalledProcessError")
+
def test_call_kwargs(self):
# call() function with keyword args
newenv = os.environ.copy()