[Python-checkins] r73933 - python/trunk/Lib/test/test_popen.py

amaury.forgeotdarc python-checkins at python.org
Sat Jul 11 11:09:59 CEST 2009


Author: amaury.forgeotdarc
Date: Sat Jul 11 11:09:59 2009
New Revision: 73933
Log:
Add basic tests for the return value of os.popen().close().
According to #6358, python 3.0 has a different implementation that behaves differently.
Modified:
 python/trunk/Lib/test/test_popen.py
Modified: python/trunk/Lib/test/test_popen.py
==============================================================================
--- python/trunk/Lib/test/test_popen.py	(original)
+++ python/trunk/Lib/test/test_popen.py	Sat Jul 11 11:09:59 2009
@@ -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)
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /