From 97e5f281a7dd4ce7ae0d5a967d8da0623e1e1d56 Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Sat, 11 Jul 2009 09:35:13 +0000 Subject: #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 --- Lib/test/test_popen.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lib/test/test_popen.py') diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index d72879280c..99ad41df74 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) -- cgit v1.2.1