summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-14 21:04:35 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-14 21:04:35 (GMT)
commitdb724fe994b180d989fd07968aab44260fa5dea5 (patch)
tree12ee56d62961b28c46ff358f662d4faeaadd13b9
parent6b688d8162bc0629286644ba901dcd40c2d35303 (diff)
downloadcpython-db724fe994b180d989fd07968aab44260fa5dea5.zip
cpython-db724fe994b180d989fd07968aab44260fa5dea5.tar.gz
cpython-db724fe994b180d989fd07968aab44260fa5dea5.tar.bz2
Issue #17753: Skip test_zipfile tests which require write access to test
and email.test.
-rw-r--r--Lib/test/test_zipfile.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 76e32fb..4633fe6 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -648,7 +648,12 @@ class PyZipFileTests(unittest.TestCase):
if name + 'o' not in namelist:
self.assertIn(name + 'c', namelist)
+ def requiresWriteAccess(self, path):
+ if not os.access(path, os.W_OK, effective_ids=True):
+ self.skipTest('requires write access to the installed location')
+
def test_write_pyfile(self):
+ self.requiresWriteAccess(os.path.dirname(__file__))
with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
fn = __file__
if fn.endswith('.pyc') or fn.endswith('.pyo'):
@@ -680,6 +685,7 @@ class PyZipFileTests(unittest.TestCase):
def test_write_python_package(self):
import email
packagedir = os.path.dirname(email.__file__)
+ self.requiresWriteAccess(packagedir)
with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
zipfp.writepy(packagedir)
@@ -693,6 +699,7 @@ class PyZipFileTests(unittest.TestCase):
def test_write_filtered_python_package(self):
import test
packagedir = os.path.dirname(test.__file__)
+ self.requiresWriteAccess(packagedir)
with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp:
@@ -721,6 +728,7 @@ class PyZipFileTests(unittest.TestCase):
def test_write_with_optimization(self):
import email
packagedir = os.path.dirname(email.__file__)
+ self.requiresWriteAccess(packagedir)
# use .pyc if running test in optimization mode,
# use .pyo if running test in debug mode
optlevel = 1 if __debug__ else 0