Add basic tests for the return value of os.popen().close().

According to #6358, python 3.0 has a different implementation that behaves differently.
This commit is contained in:
Amaury Forgeot d'Arc 2009-07-11 09:09:59 +00:00
parent ef6007c1ae
commit 9175742ef0
1 changed files with 7 additions and 0 deletions

View File

@ -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)