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 069f370..cb65fdf 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -40,6 +40,13 @@
)
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)