mirror of https://github.com/python/cpython
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. ........
This commit is contained in:
parent
9f3cf26999
commit
fcbf5d0ac1
|
@ -344,8 +344,9 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
|
||||||
def test_update2(self):
|
def test_update2(self):
|
||||||
if os.path.exists("/bin/sh"):
|
if os.path.exists("/bin/sh"):
|
||||||
os.environ.update(HELLO="World")
|
os.environ.update(HELLO="World")
|
||||||
value = os.popen("/bin/sh -c 'echo $HELLO'").read().strip()
|
with os.popen("/bin/sh -c 'echo $HELLO'") as popen:
|
||||||
self.assertEquals(value, "World")
|
value = popen.read().strip()
|
||||||
|
self.assertEquals(value, "World")
|
||||||
|
|
||||||
class WalkTests(unittest.TestCase):
|
class WalkTests(unittest.TestCase):
|
||||||
"""Tests for os.walk()."""
|
"""Tests for os.walk()."""
|
||||||
|
|
Loading…
Reference in New Issue