Skip to content

🐛 fix(expand): respect Windows variable casing - #351

Merged
gaborbernat merged 2 commits into
pytest-dev:mainfrom
gaborbernat:fix/pytest-env-windows
Nov 19, 2026
Merged

gaborbernat merged 2 commits into
pytest-dev:mainfrom
gaborbernat:fix/pytest-env-windows

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

A mixed-case reference could abort pytest on Windows even when the variable existed. Mixed-case references in INI and transformed TOML values resolve on Windows. POSIX lookups remain case-sensitive. Previous behavior. Fixes #346.

Windows environment lookup ignores case

_expand_value passes the environment mapping directly to str.format_map. Windows can then normalize the field name on lookup. Implementation. Python environment lookup.

Behavior changes

The rule also applies when a later entry refers to a variable set earlier in the same session.

Reported by OSS Scanner, ANT-2026-GHCMEE7M.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 19, 2026
@gaborbernat
gaborbernat enabled auto-merge (squash) November 19, 2026 21:28
@gaborbernat
gaborbernat merged commit 048dc8d into pytest-dev:main Nov 19, 2026
19 checks passed
@gaborbernat
gaborbernat deleted the fix/pytest-env-windows branch November 23, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixed-case environment references fail on Windows

1 participant