Commit 90a24270 authored by Richard Oudkerk's avatar Richard Oudkerk

Close file before reopening to keep Windows happy in test_sax.

parent 636f93c6
......@@ -578,13 +578,14 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
writer.close()
support.unlink(self.fname)
self.addCleanup(cleanup)
writer.getvalue = self.getvalue
def getvalue():
# Windows will not let use reopen without first closing
writer.close()
with open(writer.name, 'rb') as f:
return f.read()
writer.getvalue = getvalue
return writer
def getvalue(self):
with open(self.fname, 'rb') as f:
return f.read()
def xml(self, doc, encoding='iso-8859-1'):
return ('<?xml version="1.0" encoding="%s"?>\n%s' %
(encoding, doc)).encode('ascii', 'xmlcharrefreplace')
......
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