Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Skip chmod checking on Windows
  • Loading branch information
encukou committed May 11, 2023
commit 2772bc642dd1765cc22f83e76ab1570a423646cc
7 changes: 6 additions & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3244,9 +3244,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
path = pathlib.Path(os.path.normpath(self.destdir / name))
self.assertIn(path, self.expected_paths)
self.expected_paths.remove(path)
if mode is not None:

# When checking mode, ignore Windows (which can only set user read and
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
# instead of hardcoding Windows.
if mode is not None and sys.platform != 'win32':
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
self.assertEqual(got, mode)

if type is None and isinstance(name, str) and name.endswith('/'):
type = tarfile.DIRTYPE
if symlink_to is not None:
Expand Down