mirror of https://github.com/python/cpython
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:
parent
71f1363c34
commit
f30645d552
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue