mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue