summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-11 09:09:59 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-11 09:09:59 (GMT)
commit9175742ef001079ef20bb8d77f4bc319e3cf13b7 (patch)
treec22dd4baf3e7d43cd1ba8f80ab8b0ce93a11a81a /Lib
parentef6007c1ae72f9d0d3607c381b99022b86c92fe9 (diff)
downloadcpython-9175742ef001079ef20bb8d77f4bc319e3cf13b7.zip
cpython-9175742ef001079ef20bb8d77f4bc319e3cf13b7.tar.gz
cpython-9175742ef001079ef20bb8d77f4bc319e3cf13b7.tar.bz2
Add basic tests for the return value of os.popen().close().
According to #6358, python 3.0 has a different implementation that behaves differently.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_popen.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
index 069f370..cb65fdf 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -40,6 +40,13 @@ class PopenTest(unittest.TestCase):
)
test_support.reap_children()
+ def test_return_code(self):
+ self.assertEqual(os.popen("exit 0").close(), None)
+ if os.name == 'nt':
+ self.assertEqual(os.popen("exit 42").close(), 42)
+ else:
+ self.assertEqual(os.popen("exit 42").close(), 42 << 8)
+
def test_main():
test_support.run_unittest(PopenTest)