summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 93cdb4ba86..49f554c605 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()."""