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:
parent
ef6007c1ae
commit
9175742ef0
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue