Hirokazu Yamamoto <ocean-c...@m2.ccsnet.ne.jp> added the comment:

I found following patch can fix test_invalid_operations error on
windows. Is this correct fix? There are many other places using bare open().

Index: Lib/test/test_io.py
===================================================================
--- Lib/test/test_io.py (revision 73422)
+++ Lib/test/test_io.py (working copy)
@@ -298,13 +298,13 @@
     def test_invalid_operations(self):
         # Try writing on a file opened in read mode and vice-versa.
         for mode in ("w", "wb"):
-            with open(support.TESTFN, mode) as fp:
+            with self.open(support.TESTFN, mode) as fp:
                 self.assertRaises(IOError, fp.read)
                 self.assertRaises(IOError, fp.readline)
-        with open(support.TESTFN, "rb") as fp:
+        with self.open(support.TESTFN, "rb") as fp:
             self.assertRaises(IOError, fp.write, b"blah")
             self.assertRaises(IOError, fp.writelines, [b"blah\n"])
-        with open(support.TESTFN, "r") as fp:
+        with self.open(support.TESTFN, "r") as fp:
             self.assertRaises(IOError, fp.write, "blah")
             self.assertRaises(IOError, fp.writelines, ["blah\n"])

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6215>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to