Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commita09e538

Browse files
committed
Don't mock the lchmod functions, and explain why
This undoes the mocking of lchmod functions frome309b35, andinstead notes why they may be better left alone in the tests.This also rewords the existing comment to better explain the reasonfor the mocking that is being done.
1 parente309b35 commita09e538

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

‎test/test_util.py

Lines 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-
ifhasattr(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-
ifhasattr(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)

[8]ページ先頭

©2009-2025 Movatter.jp