From: Amaury Forgeot d'Arc Date: Sat, 11 Jul 2009 09:09:59 +0000 (+0000) Subject: Add basic tests for the return value of os.popen().close(). X-Git-Tag: v2.7a1~801 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9175742ef001079ef20bb8d77f4bc319e3cf13b7;p=python Add basic tests for the return value of os.popen().close(). According to #6358, python 3.0 has a different implementation that behaves differently. --- diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index 069f370041..cb65fdf2fc 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)