Skip to content

Commit 2772bc6

Browse files
committed
Skip chmod checking on Windows
1 parent a83ffd7 commit 2772bc6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_tarfile.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3244,9 +3244,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
32443244
path = pathlib.Path(os.path.normpath(self.destdir / name))
32453245
self.assertIn(path, self.expected_paths)
32463246
self.expected_paths.remove(path)
3247-
if mode is not None:
3247+
3248+
# When checking mode, ignore Windows (which can only set user read and
3249+
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
3250+
# instead of hardcoding Windows.
3251+
if mode is not None and sys.platform != 'win32':
32483252
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
32493253
self.assertEqual(got, mode)
3254+
32503255
if type is None and isinstance(name, str) and name.endswith('/'):
32513256
type = tarfile.DIRTYPE
32523257
if symlink_to is not None:

0 commit comments

Comments
 (0)