mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #26494 -- Made Archive.extract() preserve file permissions.
This commit is contained in:
parent
dd99e69fa8
commit
d0112cf930
6 changed files with 15 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,7 @@
|
|||
import os
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
@ -42,6 +44,14 @@ class ArchiveTester(object):
|
|||
extract(self.archive_path, self.tmpdir)
|
||||
self.check_files(self.tmpdir)
|
||||
|
||||
@unittest.skipIf(sys.platform == 'win32', 'Python on Windows has a limited os.chmod().')
|
||||
def test_extract_file_permissions(self):
|
||||
"""Archive.extract() preserves file permissions."""
|
||||
extract(self.archive_path, self.tmpdir)
|
||||
filepath = os.path.join(self.tmpdir, 'executable')
|
||||
# The file has executable permission.
|
||||
self.assertTrue(os.stat(filepath).st_mode & stat.S_IXOTH)
|
||||
|
||||
def test_extract_function_with_leadpath(self):
|
||||
extract(self.archive_lead_path, self.tmpdir)
|
||||
self.check_files(self.tmpdir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue