[Python-checkins] cpython: Close a stream properly in test.test_pulldom.

brett.cannon python-checkins at python.org
Tue Mar 15 22:23:28 CET 2011


http://hg.python.org/cpython/rev/aa000dd4287f
changeset:   68556:aa000dd4287f
parent:      68532:e04253f3ad4a
user:        Brett Cannon <brett at python.org>
date:        Tue Mar 15 17:22:52 2011 -0400
summary:
  Close a stream properly in test.test_pulldom.

Closes issue #11550. Thanks to Ben Hayden for some inspiration on the
solution.

files:
  Lib/test/test_pulldom.py

diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py
--- a/Lib/test/test_pulldom.py
+++ b/Lib/test/test_pulldom.py
@@ -32,7 +32,9 @@
         # 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list