Skip to content

Commit

Permalink
Skip chmod checking on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou authored and mcepl committed May 9, 2023
1 parent abb0e84 commit 7ab6233
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 7ab6233

Please sign in to comment.