summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_popen.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-11 09:35:13 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-11 09:35:13 (GMT)
commit97e5f281a7dd4ce7ae0d5a967d8da0623e1e1d56 (patch)
treeba58b176a13ca8fcc7c020a61933e674d113fa64 /Lib/test/test_popen.py
parent15ccb3d3f741ceffd7b2dca67870bbee5cfe3a49 (diff)
downloadcpython-97e5f281a7dd4ce7ae0d5a967d8da0623e1e1d56.zip
cpython-97e5f281a7dd4ce7ae0d5a967d8da0623e1e1d56.tar.gz
cpython-97e5f281a7dd4ce7ae0d5a967d8da0623e1e1d56.tar.bz2
#6358: Merge r73933: Add basic tests for the return value of os.popen().close().
And fix the implementation to make these tests pass with py3k
Diffstat (limited to 'Lib/test/test_popen.py')
-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 d728792..99ad41d 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -42,6 +42,13 @@ class PopenTest(unittest.TestCase):
)
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():
support.run_unittest(PopenTest)