From: Serhiy Storchaka Date: Sat, 19 Sep 2015 07:55:20 +0000 (+0300) Subject: Issue #25101: Try to create a file to test write access in test_zipfile. X-Git-Tag: v2.7.11rc1~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90f5f5151c4542d391660c726d611350b28ff4f2;p=thirdparty%2FPython%2Fcpython.git Issue #25101: Try to create a file to test write access in test_zipfile. --- diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 71c6605829cb..01750c1b125b 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -778,6 +778,13 @@ class PyZipFileTests(unittest.TestCase): def requiresWriteAccess(self, path): if not os.access(path, os.W_OK): 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__))