summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_popen.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_popen.py')
-rw-r--r--Lib/test/test_popen.py3
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)