Skip to content

Mixed-case environment references fail on Windows #346

Closed

Description

@gaborbernat

An environment variable that Windows resolves in a mixed-case lookup fails to expand in an env entry. pytest stops before collection.

Affected code

Configuration handling at ac5583c

Mechanism

Expanding with **os.environ copies the uppercase Windows keys into a case-sensitive keyword dictionary. A lookup using the environment mapping directly honors Windows casing. Reference

Reproduction

Run at ac5583cb5181 with pytest 9.2.0 on Windows 11 in the checkout.

.tox/dev/Scripts/python -m pytest -o "env=PROBE={SystemRoot}" --collect-only -q tests/test_version.py

Observed output:

KeyError: 'SystemRoot'

Resolve the reference using Windows environment lookup rules.

Impact

Moderate to reproduce because it requires Windows. Exposure is common among Windows projects that use mixed-case names such as SystemRoot. Verified on Windows 11.

Credits

OSS Scanner report ANT-2026-GHCMEE7M.

Activity

  1. added
    bug
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions