Skip to content

Commit fc9913d

Browse files
committed
Skip chmod checking on Windows
1 parent 921e5f1 commit fc9913d

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
@@ -3049,9 +3049,14 @@ def expect_file(self, name, type=None, symlink_to=None, mode=None):
30493049
path = pathlib.Path(os.path.normpath(self.destdir / name))
30503050
self.assertIn(path, self.expected_paths)
30513051
self.expected_paths.remove(path)
3052-
if mode is not None:
3052+
3053+
# When checking mode, ignore Windows (which can only set user read and
3054+
# user write bits). Newer versions of Python use `os_helper.can_chmod()`
3055+
# instead of hardcoding Windows.
3056+
if mode is not None and sys.platform != 'win32':
30533057
got = stat.filemode(stat.S_IMODE(path.stat().st_mode))
30543058
self.assertEqual(got, mode)
3059+
30553060
if type is None and isinstance(name, str) and name.endswith('/'):
30563061
type = tarfile.DIRTYPE
30573062
if symlink_to is not None:

0 commit comments

Comments
 (0)