diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-31 01:35:53 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-31 01:35:53 (GMT) |
commit | aa7cec0ac489990a9607c6231241a39921ba6ca5 (patch) | |
tree | d3c7c320237910489c6a69bfb592fd0d450f517a | |
parent | 556c7355ddf06397f105b283986a7876218d7b26 (diff) | |
download | cpython-aa7cec0ac489990a9607c6231241a39921ba6ca5.zip cpython-aa7cec0ac489990a9607c6231241a39921ba6ca5.tar.gz cpython-aa7cec0ac489990a9607c6231241a39921ba6ca5.tar.bz2 |
close file properly
-rw-r--r-- | Lib/test/test_popen.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py index da0c04e..accf187 100644 --- a/Lib/test/test_popen.py +++ b/Lib/test/test_popen.py @@ -22,7 +22,8 @@ class PopenTest(unittest.TestCase): 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) |