[Python-checkins] cpython (2.7): Issue #17753: Skip test_zipfile tests which require write access to test

serhiy.storchaka python-checkins at python.org
Sat Feb 14 22:17:57 CET 2015


https://hg.python.org/cpython/rev/dfe75713f152
changeset: 94619:dfe75713f152
branch: 2.7
parent: 94616:eb3a6243af33
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Feb 14 23:17:13 2015 +0200
summary:
 Issue #17753: Skip test_zipfile tests which require write access to test
and email.test.
files:
 Lib/test/test_zipfile.py | 6 ++++++
 1 files changed, 6 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
@@ -775,7 +775,12 @@
 
 
 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')
+
 def test_write_pyfile(self):
+ self.requiresWriteAccess(os.path.dirname(__file__))
 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
 fn = __file__
 if fn.endswith('.pyc') or fn.endswith('.pyo'):
@@ -803,6 +808,7 @@
 def test_write_python_package(self):
 import email
 packagedir = os.path.dirname(email.__file__)
+ self.requiresWriteAccess(packagedir)
 
 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
 zipfp.writepy(packagedir)
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /