diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-07-25 19:58:18 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-07-25 19:58:18 (GMT) |
commit | 6e1df8d0d44817a7b9810c7d8b5c81423fb52cdb (patch) | |
tree | 588d5f9bb3fd88f16e1ec09ea3556dde21647f4f /Lib/test/test_zipfile.py | |
parent | c2542e986d0070840e8e8833268b9d5c9f297f7c (diff) | |
download | cpython-6e1df8d0d44817a7b9810c7d8b5c81423fb52cdb.zip cpython-6e1df8d0d44817a7b9810c7d8b5c81423fb52cdb.tar.gz cpython-6e1df8d0d44817a7b9810c7d8b5c81423fb52cdb.tar.bz2 |
Merged revisions 65235 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65235 | antoine.pitrou | 2008-07-25 21:42:26 +0200 (ven., 25 juil. 2008) | 3 lines
#3394: zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix
........
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r-- | Lib/test/test_zipfile.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index a647fc6..9e565fb 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -365,6 +365,19 @@ class TestsWithSourceFile(unittest.TestCase): # remove the test file subdirectories shutil.rmtree(os.path.join(os.getcwd(), 'ziptest2dir')) + def zip_test_writestr_permissions(self, f, compression): + # Make sure that writestr creates files with mode 0600, + # when it is passed a name rather than a ZipInfo instance. + + self.makeTestArchive(f, compression) + zipfp = zipfile.ZipFile(f, "r") + zinfo = zipfp.getinfo('strfile') + self.assertEqual(zinfo.external_attr, 0o600 << 16) + + def test_writestr_permissions(self): + for f in (TESTFN2, TemporaryFile(), io.BytesIO()): + self.zip_test_writestr_permissions(f, zipfile.ZIP_STORED) + def tearDown(self): os.remove(TESTFN) os.remove(TESTFN2) |