Close a stream properly in test.test_pulldom.

Closes issue #11550. Thanks to Ben Hayden for some inspiration on the
solution.
This commit is contained in:
Brett Cannon 2011-03-15 17:22:52 -04:00
parent 71f1363c34
commit f30645d552

View file

@ -32,7 +32,9 @@ def test_parse(self):
# fragment.
# Test with a filename:
list(pulldom.parse(tstfile))
handler = pulldom.parse(tstfile)
self.addCleanup(handler.stream.close)
list(handler)
# Test with a file object:
with open(tstfile, "rb") as fin: