[Python-checkins] r86015 - python/branches/py3k/Lib/test/test_popen.py

benjamin.peterson python-checkins at python.org
Sun Oct 31 02:35:53 CET 2010


Author: benjamin.peterson
Date: Sun Oct 31 02:35:53 2010
New Revision: 86015

Log:
close file properly

Modified:
   python/branches/py3k/Lib/test/test_popen.py

Modified: python/branches/py3k/Lib/test/test_popen.py
==============================================================================
--- python/branches/py3k/Lib/test/test_popen.py	(original)
+++ python/branches/py3k/Lib/test/test_popen.py	Sun Oct 31 02:35:53 2010
@@ -22,7 +22,8 @@
     def _do_test_commandline(self, cmdline, expected):
         cmd = '%s -c "import sys; print(sys.argv)" %s'
         cmd = cmd % (python, cmdline)
-        data = os.popen(cmd).read()
+        with os.popen(cmd) as p:
+            data = p.read()
         got = eval(data)[1:] # strip off argv[0]
         self.assertEqual(got, expected)
 


More information about the Python-checkins mailing list