diff options
author | Brian Curtin <brian.curtin@gmail.com> | 2010-10-30 21:29:52 (GMT) |
---|---|---|
committer | Brian Curtin <brian.curtin@gmail.com> | 2010-10-30 21:29:52 (GMT) |
commit | fcbf5d0ac1effca9ffc18eb96db479f6c8ac0b6b (patch) | |
tree | 5de12a8a2b8ab1573a123ef3f160c8fda88345e6 | |
parent | 9f3cf269995cce0867a1a63b77b7f5985ad339fd (diff) | |
download | cpython-fcbf5d0ac1effca9ffc18eb96db479f6c8ac0b6b.zip cpython-fcbf5d0ac1effca9ffc18eb96db479f6c8ac0b6b.tar.gz cpython-fcbf5d0ac1effca9ffc18eb96db479f6c8ac0b6b.tar.bz2 |
Merged revisions 85987 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85987 | brian.curtin | 2010-10-30 16:24:21 -0500 (Sat, 30 Oct 2010) | 2 lines
Fix #10257. Clear resource warnings by using os.popen's context manager.
........
-rw-r--r-- | Lib/test/test_os.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 93cdb4b..49f554c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -344,8 +344,9 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol): def test_update2(self): if os.path.exists("/bin/sh"): os.environ.update(HELLO="World") - value = os.popen("/bin/sh -c 'echo $HELLO'").read().strip() - self.assertEquals(value, "World") + with os.popen("/bin/sh -c 'echo $HELLO'") as popen: + value = popen.read().strip() + self.assertEquals(value, "World") class WalkTests(unittest.TestCase): """Tests for os.walk().""" |