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

Commit7604da1

Browse files
committed
Warn if HIDE_WINDOWS_*_ERRORS set in environment
This warns if the HIDE_WINDOWS_KNOWN_ERRORS orHIDE_WINDOWS_FREEZE_ERRORS environment variables are set. Thesebehave unexpectedly, including (and especially) in their effect onthe same-named git.util module attributes, and neither theireffects nor those of those attributes are documented in a way thatwould have supported code outside the project relying on theirspecific semantics.The new warning message characterizes their status as deprecated.- This is now the case for HIDE_WINDOWS_KNOWN_ERRORS, and almost so for the same-named attribute, whose existence (though not its meaning) can technically be relied on due to inclusion in `__all__` (which this does *not* change).- But the HIDE_WINDOWS_FREEZE_ERRORS attribute was never guaranteed even to exist, so technically neither it nor the same-named environment variable are not *even* deprecated. The attribute's presence has never been reflected in the public interface of any GitPython component in any way.However, these attributes are still used by the tests. Furthermore,in the case of HIDE_WINDOWS_KNOWN_ERRORS, setting it is the onlyway to disable the behavior of converting errors from some filedeletion operations into SkipTest exceptions on Windows. Since thatbehavior has not yet changed, but is unlikely to be desired outsideof testing, no *attributes* are deprecated at this time, and noeffort to warn from accessing or using attributes is attempted.
1 parent100ab98 commit7604da1

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎git/util.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,28 @@
109109

110110
log=logging.getLogger(__name__)
111111

112-
# types############################################################
112+
113+
def_read_env_flag(name:str,default:bool)->Union[bool,str]:
114+
try:
115+
value=os.environ[name]
116+
exceptKeyError:
117+
returndefault
118+
119+
log.warning(
120+
"The %s environment variable is deprecated. Its effect has never been documented and changes without warning.",
121+
name,
122+
)
123+
124+
# FIXME: This should always return bool, as that is how it is used.
125+
# FIXME: This should treat some values besides "" as expressing falsehood.
126+
returnvalue
113127

114128

115129
#: We need an easy way to see if Appveyor TCs start failing,
116130
#: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy,
117131
#: till then, we wish to hide them.
118-
HIDE_WINDOWS_KNOWN_ERRORS=is_winandos.environ.get("HIDE_WINDOWS_KNOWN_ERRORS",True)
119-
HIDE_WINDOWS_FREEZE_ERRORS=is_winandos.environ.get("HIDE_WINDOWS_FREEZE_ERRORS",True)
132+
HIDE_WINDOWS_KNOWN_ERRORS=is_winand_read_env_flag("HIDE_WINDOWS_KNOWN_ERRORS",True)
133+
HIDE_WINDOWS_FREEZE_ERRORS=is_winand_read_env_flag("HIDE_WINDOWS_FREEZE_ERRORS",True)
120134

121135
# { Utility Methods
122136

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp