Skip to content
Closed
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 9, 2023
commit 62602ff60ac0302a0d57cfde5da9c11b0aef9b0f
7 changes: 6 additions & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3284,9 +3284,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