[pypy-svn] r34210 - pypy/branch/refactor-file/pypy/module/_file/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Nov 5 11:10:52 CET 2006


Author: cfbolz
Date: Sun Nov  5 11:10:51 2006
New Revision: 34210

Modified:
   pypy/branch/refactor-file/pypy/module/_file/test/test_file.py
Log:
check that the mode is set correctly when creating a file


Modified: pypy/branch/refactor-file/pypy/module/_file/test/test_file.py
==============================================================================
--- pypy/branch/refactor-file/pypy/module/_file/test/test_file.py	(original)
+++ pypy/branch/refactor-file/pypy/module/_file/test/test_file.py	Sun Nov  5 11:10:51 2006
@@ -49,3 +49,15 @@
     def test_wraposerror(self):
         import _file
         raises(IOError, _file.file, "hopefully/not/existant.bar")
+
+    def test_correct_file_mode(self):
+        import _file, os
+        f = _file.file(self.temppath, "w")
+        umask = os.umask(18)
+        os.umask(umask)
+        try:
+            f.write("foo")
+        finally:
+            f.close()
+        assert oct(os.stat(self.temppath).st_mode & 0777 | umask) == oct(0666)
+



More information about the Pypy-commit mailing list