summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-05-18 17:13:16 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-05-18 17:13:16 (GMT)
commit850800f15ef3cfa51dfafbc41a1bb574fb542ded (patch)
treed9d991dfe4fe10786757997c47a2cf0072017476
parent25296ce5de6501ac3eb3ed2631288b63c3ad61c7 (diff)
parent90a24270f8a76fffbce0a09fb0e879d9ac60cabe (diff)
downloadcpython-850800f15ef3cfa51dfafbc41a1bb574fb542ded.zip
cpython-850800f15ef3cfa51dfafbc41a1bb574fb542ded.tar.gz
cpython-850800f15ef3cfa51dfafbc41a1bb574fb542ded.tar.bz2
Merge.
-rw-r--r--Lib/test/test_sax.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 78a1c69..cfa18f7 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -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')