Skip to content

Commit

Permalink
config: make normalization of Boolean env vars case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Jan 20, 2025
1 parent b9e1c61 commit 93fd1a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/poetry/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def boolean_validator(val: str) -> bool:


def boolean_normalizer(val: str) -> bool:
return val in ["true", "1"]
return val.lower() in ["true", "1"]


def int_normalizer(val: str) -> int:
Expand Down
12 changes: 11 additions & 1 deletion tests/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ def test_config_get_processes_depended_on_values(

def generate_environment_variable_tests() -> Iterator[tuple[str, str, str, bool]]:
data: list[tuple[Normalizer, list[tuple[str, Any]]]] = [
(boolean_normalizer, [("true", True), ("false", False)]),
(
boolean_normalizer,
[
("true", True),
("false", False),
("True", True),
("False", False),
("1", True),
("0", False),
],
),
(int_normalizer, [("4", 4), ("2", 2)]),
]

Expand Down

0 comments on commit 93fd1a8

Please sign in to comment.