summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sax.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-05-13 20:34:21 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-05-13 20:34:21 (GMT)
commit2adb6fe246c0e07b30a70cd5c08e4aebc5b2923d (patch)
tree10d2ca7c4033de4ae4eb6c67681e88aa3d514216 /Lib/test/test_sax.py
parentbf4cba7e8b2fd95351e28378c7716a62911d13e5 (diff)
downloadcpython-2adb6fe246c0e07b30a70cd5c08e4aebc5b2923d.zip
cpython-2adb6fe246c0e07b30a70cd5c08e4aebc5b2923d.tar.gz
cpython-2adb6fe246c0e07b30a70cd5c08e4aebc5b2923d.tar.bz2
Fix ResourceWarnings in test_sax
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r--Lib/test/test_sax.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 502c962..78a1c69 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -574,7 +574,10 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
def ioclass(self):
writer = codecs.open(self.fname, 'w', encoding='ascii',
errors='xmlcharrefreplace', buffering=0)
- self.addCleanup(support.unlink, self.fname)
+ def cleanup():
+ writer.close()
+ support.unlink(self.fname)
+ self.addCleanup(cleanup)
writer.getvalue = self.getvalue
return writer