mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
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
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue