summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pulldom.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2011-03-15 21:22:52 (GMT)
committerBrett Cannon <brett@python.org>2011-03-15 21:22:52 (GMT)
commitf30645d5521afe5537befd0d9e84a7c539135cdc (patch)
treea90e98bb8184342fdf862870f90e70be653252c3 /Lib/test/test_pulldom.py
parent71f1363c349c6ccab38870d328cee4de9081c8f9 (diff)
downloadcpython-f30645d5521afe5537befd0d9e84a7c539135cdc.zip
cpython-f30645d5521afe5537befd0d9e84a7c539135cdc.tar.gz
cpython-f30645d5521afe5537befd0d9e84a7c539135cdc.tar.bz2
Close a stream properly in test.test_pulldom.
Closes issue #11550. Thanks to Ben Hayden for some inspiration on the solution.
Diffstat (limited to 'Lib/test/test_pulldom.py')
-rw-r--r--Lib/test/test_pulldom.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py
index 4171526..b81a595 100644
--- a/Lib/test/test_pulldom.py
+++ b/Lib/test/test_pulldom.py
@@ -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: