← 返回首页
Better explain the Windows and Unix cases · gitpython-developers/GitPython@ba5bc45 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit ba5bc45

Browse files
committed
Better explain the Windows and Unix cases
Of PermissionError, in the rmtree tests.
1 parent 7d98f94 commit ba5bc45

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎test/test_util.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ def permission_error_tmpdir(tmp_path):
4949
td = tmp_path / "testdir"
5050
td.mkdir()
5151
(td / "x").write_bytes(b"")
52-
(td / "x").chmod(stat.S_IRUSR) # Set up PermissionError on Windows.
53-
td.chmod(stat.S_IRUSR | stat.S_IXUSR) # Set up PermissionError on Unix.
52+
53+
# Set up PermissionError on Windows, where we can't delete read-only files.
54+
(td / "x").chmod(stat.S_IRUSR)
55+
56+
# Set up PermissionError on Unix, where we can't delete files in read-only directories.
57+
td.chmod(stat.S_IRUSR | stat.S_IXUSR)
58+
5459
yield td
5560

5661

@@ -113,7 +118,7 @@ def test_wraps_perm_error_if_enabled(self, mocker, permission_error_tmpdir):
113118
# git.index.util "replaces" git.util and is what "import git.util" gives us.
114119
mocker.patch.object(sys.modules["git.util"], "HIDE_WINDOWS_KNOWN_ERRORS", True)
115120

116-
# Disable common chmod functions so the callback can't fix the problem.
121+
# Disable common chmod functions so the callback can never fix the problem.
117122
mocker.patch.object(os, "chmod")
118123
mocker.patch.object(pathlib.Path, "chmod")
119124

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.