Commit aa7cec0a authored by Benjamin Peterson's avatar Benjamin Peterson

close file properly

parent 556c7355
...@@ -22,7 +22,8 @@ class PopenTest(unittest.TestCase): ...@@ -22,7 +22,8 @@ class PopenTest(unittest.TestCase):
def _do_test_commandline(self, cmdline, expected): def _do_test_commandline(self, cmdline, expected):
cmd = '%s -c "import sys; print(sys.argv)" %s' cmd = '%s -c "import sys; print(sys.argv)" %s'
cmd = cmd % (python, cmdline) 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] got = eval(data)[1:] # strip off argv[0]
self.assertEqual(got, expected) self.assertEqual(got, expected)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment