From 98449ffda4191d635d6ec91f30d88fd3ec63765f Mon Sep 17 00:00:00 2001 From: Daniel Goldman Date: Wed, 25 Dec 2024 13:46:44 -0500 Subject: [PATCH] add test cases - exact match for names with glob characters in them - case sensitivity (`fnmatch.fnmatch` normalises case on Windows) --- src/python/pants/engine/environment_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/python/pants/engine/environment_test.py b/src/python/pants/engine/environment_test.py index 5a13298c3bd..7568a058a2d 100644 --- a/src/python/pants/engine/environment_test.py +++ b/src/python/pants/engine/environment_test.py @@ -46,6 +46,8 @@ def test_envvar_fnmatch() -> None: { "LETTER_C": "prefix_char_match", "LETTER_PI": "prefix", + "LETTER_P*": "exact_match_with_glob", + "letter_lower": "case-sensitive", } ) @@ -53,4 +55,14 @@ def test_envvar_fnmatch() -> None: assert char_match == {"LETTER_C": "prefix_char_match"} multichar_match = pants_env.get_subset(["LETTER_*"]) - assert multichar_match == {"LETTER_C": "prefix_char_match", "LETTER_PI": "prefix"} + assert multichar_match == { + "LETTER_C": "prefix_char_match", + "LETTER_PI": "prefix", + "LETTER_P*": "exact_match_with_glob", + } + + exact_match_with_glob = pants_env.get_subset(["LETTER_P*"]) + assert exact_match_with_glob == {"LETTER_P*": "exact_match_with_glob"} + + case_sensitive = pants_env.get_subset(["LETTER_LOWER"]) + assert case_sensitive == {}