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

Commitb8e009e

Browse files
committed
In rmtree, have onerror catch only PermissionError
The onerror function is still called on, and tries to resolve, anyexception. But now, when it re-calls the file deletion functionpassed as func, the only exception it catches to conditionallyconvert to SkipTest is PermissionError (or derived exceptions).The old behavior of catching Exception was overly broad, andinconsistent with the hard-coded prefix of "FIXME: fails with:PermissionError" used to build the SkipTest exception messages.This commit also changes the message to use an f-string (which wasone of the styles in the equivalent but differently coded duplicatelogic eliminated in5039df3, and seems clearer in this case). Thatchange is a pure refactoring, not affecting generated messages.
1 parent2a32e25 commitb8e009e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎git/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ def onerror(func: Callable, path: PathLike, exc_info: str) -> None:
188188

189189
try:
190190
func(path)# Will scream if still not possible to delete.
191-
exceptExceptionasex:
191+
exceptPermissionErrorasex:
192192
ifHIDE_WINDOWS_KNOWN_ERRORS:
193193
fromunittestimportSkipTest
194194

195-
raiseSkipTest("FIXME: fails with: PermissionError\n {}".format(ex))fromex
195+
raiseSkipTest(f"FIXME: fails with: PermissionError\n{ex}")fromex
196196
raise
197197

198198
returnshutil.rmtree(path,False,onerror)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp