Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a09e538

Browse filesBrowse files
committed
Don't mock the lchmod functions, and explain why
This undoes the mocking of lchmod functions from e309b35, and instead notes why they may be better left alone in the tests. This also rewords the existing comment to better explain the reason for the mocking that is being done.
1 parent e309b35 commit a09e538
Copy full SHA for a09e538

File tree

Expand file treeCollapse file tree

1 file changed

+3
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-7
lines changed

‎test/test_util.py

Copy file name to clipboardExpand all lines: test/test_util.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,11 @@ def _patch_for_wrapping_test(self, mocker, hide_windows_known_errors):
140140
# git.index.util "replaces" git.util and is what "import git.util" gives us.
141141
mocker.patch.object(sys.modules["git.util"], "HIDE_WINDOWS_KNOWN_ERRORS", hide_windows_known_errors)
142142

143-
# Disable some chmod functions so the callback can't fix a PermissionError.
143+
# Mock out common chmod functions to simulate PermissionError the callback can't
144+
# fix. (We leave the corresponding lchmod functions alone. If they're used, it's
145+
# more important we detect any failures from inadequate compatibility checks.)
144146
mocker.patch.object(os, "chmod")
145-
if hasattr(os, "lchmod"):
146-
# Exists on some operating systems. Mocking out os.chmod doesn't affect it.
147-
mocker.patch.object(os, "lchmod")
148147
mocker.patch.object(pathlib.Path, "chmod")
149-
if hasattr(pathlib.Path, "lchmod"):
150-
# Exists on some Python versions. Don't rely on it calling a public chmod.
151-
mocker.patch.object(pathlib.Path, "lchmod")
152148

153149
@pytest.mark.skipif(
154150
os.name != "nt",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.