Skip to content

Commit 7ab6233

Browse files
encukoumcepl
authored andcommitted
Skip chmod checking on Windows
1 parent abb0e84 commit 7ab6233

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
@@ -3284,9 +3284,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
32843284
path = pathlib.Path(os.path.normpath(self.destdir / name))
32853285
self.assertIn(path, self.expected_paths)
32863286
self.expected_paths.remove(path)
3287-
if mode is not None:
3287+
3288+
# When checking mode, ignore Windows (which can only set user read and
3289+
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
3290+
# instead of hardcoding Windows.
3291+
if mode is not None and sys.platform != 'win32':
32883292
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
32893293
self.assertEqual(got, mode)
3294+
32903295
if type is None and isinstance(name, str) and name.endswith('/'):
32913296
type = tarfile.DIRTYPE
32923297
if symlink_to is not None:

0 commit comments

Comments
 (0)