[Python-checkins] cpython (merge 3.5 -> default): Issue #25101: Try to create a file to test write access in test_zipfile.

serhiy.storchaka python-checkins at python.org
Sat Sep 19 10:00:53 CEST 2015


https://hg.python.org/cpython/rev/399746fde4f8
changeset:   98069:399746fde4f8
parent:      98065:fb9d0fffb494
parent:      98068:6899bf8d21c3
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Sep 19 11:00:11 2015 +0300
summary:
  Issue #25101: Try to create a file to test write access in test_zipfile.

files:
  Lib/test/test_zipfile.py |  7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -684,6 +684,13 @@
         if not os.access(path, os.W_OK,
                          effective_ids=os.access in os.supports_effective_ids):
             self.skipTest('requires write access to the installed location')
+        filename = os.path.join(path, 'test_zipfile.try')
+        try:
+            fd = os.open(filename, os.O_WRONLY | os.O_CREAT)
+            os.close(fd)
+        except Exception:
+            self.skipTest('requires write access to the installed location')
+        unlink(filename)
 
     def test_write_pyfile(self):
         self.requiresWriteAccess(os.path.dirname(__file__))

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list