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

Commiteb51277

Browse files
committed
Make HIDE_* attributes always bool
For now, this doesn't change how the correspondng environmentvariables are interpreted, in terms of truth and falsehood.But it does *convert* them to bool, so that the values of theHIDE_WINDOWS_KNOWN_ERRORS and HIDE_WINDOWS_FREEZE_ERRORSattributes are always bools.It also updates the tests accordingly, to validate this behavior.
1 parent7604da1 commiteb51277

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

‎git/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
log=logging.getLogger(__name__)
111111

112112

113-
def_read_env_flag(name:str,default:bool)->Union[bool,str]:
113+
def_read_env_flag(name:str,default:bool)->bool:
114114
try:
115115
value=os.environ[name]
116116
exceptKeyError:
@@ -121,9 +121,8 @@ def _read_env_flag(name: str, default: bool) -> Union[bool, str]:
121121
name,
122122
)
123123

124-
# FIXME: This should always return bool, as that is how it is used.
125124
# FIXME: This should treat some values besides "" as expressing falsehood.
126-
returnvalue
125+
returnbool(value)
127126

128127

129128
#: We need an easy way to see if Appveyor TCs start failing,

‎test/test_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ def run_parse(value):
520520
)
521521
returnast.literal_eval(output)
522522

523-
assert_true_iff_win=self.assertTrueifos.name=="nt"elseself.assertFalse
523+
true_iff_win=os.name=="nt"# Same as is_win, but don't depend on that here.
524524

525525
truthy_cases= [
526526
("unset",None),
@@ -542,8 +542,8 @@ def run_parse(value):
542542

543543
formsg,env_var_valueintruthy_cases:
544544
withself.subTest(msg,env_var_value=env_var_value):
545-
assert_true_iff_win(run_parse(env_var_value))
545+
self.assertIs(run_parse(env_var_value),true_iff_win)
546546

547547
formsg,env_var_valueinfalsy_cases:
548548
withself.subTest(msg,env_var_value=env_var_value):
549-
self.assertFalse(run_parse(env_var_value))
549+
self.assertIs(run_parse(env_var_value),False)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp