diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index 069f370041d..cb65fdf2fcd 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)