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
1 changed files with 3 additions and 1 deletions

View File

@ -32,7 +32,9 @@ class PullDOMTestCase(unittest.TestCase):
# 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: