Fix ResourceWarnings in test_sax

This commit is contained in:
Antoine Pitrou 2013-05-13 22:34:21 +02:00
parent bf4cba7e8b
commit 2adb6fe246

View File

@ -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