diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-14 21:06:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-14 21:06:42 (GMT) |
commit | 2307287c92e77668b687caede996966ced48002c (patch) | |
tree | 1ec79dc7c3e3f1f33c6b9b4370ffa34c5465bdbf /Lib/test/test_zipfile.py | |
parent | 86a35bcba9e9d5aea51df68683bedc3b333be3bf (diff) | |
parent | db724fe994b180d989fd07968aab44260fa5dea5 (diff) | |
download | cpython-2307287c92e77668b687caede996966ced48002c.zip cpython-2307287c92e77668b687caede996966ced48002c.tar.gz cpython-2307287c92e77668b687caede996966ced48002c.tar.bz2 |
Issue #17753: Skip test_zipfile tests which require write access to test
and email.test.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r-- | Lib/test/test_zipfile.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index abe80e4..017c646 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -679,7 +679,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'): @@ -711,6 +716,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) @@ -724,6 +730,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: @@ -752,6 +759,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 |