Skip to content

Commit 4a17b3d

Browse files
committed
Skip chmod checking on Windows
1 parent cabcaf2 commit 4a17b3d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_tarfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3059,9 +3059,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
30593059
path = pathlib.Path(os.path.normpath(self.destdir / name))
30603060
self.assertIn(path, self.expected_paths)
30613061
self.expected_paths.remove(path)
3062-
if mode is not None:
3062+
3063+
# When checking mode, ignore Windows (which can only set user read and
3064+
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
3065+
# instead of hardcoding Windows.
3066+
if mode is not None and sys.platform != 'win32':
30633067
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
30643068
self.assertEqual(got, mode)
3069+
30653070
if type is None and isinstance(name, str) and name.endswith('/'):
30663071
type = tarfile.DIRTYPE
30673072
if symlink_to is not None:

0 commit comments

Comments
 (0)