Commit 2adb6fe2 authored by Antoine Pitrou's avatar Antoine Pitrou

Fix ResourceWarnings in test_sax

parent bf4cba7e
...@@ -574,7 +574,10 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase): ...@@ -574,7 +574,10 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
def ioclass(self): def ioclass(self):
writer = codecs.open(self.fname, 'w', encoding='ascii', writer = codecs.open(self.fname, 'w', encoding='ascii',
errors='xmlcharrefreplace', buffering=0) 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 writer.getvalue = self.getvalue
return writer return writer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment