diff --git a/docs/changelog/3302.bugfix.rst b/docs/changelog/3302.bugfix.rst new file mode 100644 index 000000000..99249b6cc --- /dev/null +++ b/docs/changelog/3302.bugfix.rst @@ -0,0 +1 @@ +- Add ``windir`` to the default list of Windows ``pass_env`` environment variables. - by :user:`kurtmckee` diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py index 260252a68..b98ad3b0a 100644 --- a/src/tox/tox_env/api.py +++ b/src/tox/tox_env/api.py @@ -231,6 +231,7 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301 "USERPROFILE", # needed for `os.path.expanduser()` "PATHEXT", # needed for discovering executables "MSYSTEM", # controls paths printed format + "WINDIR", # base path to system executables and DLLs ], ) else: # pragma: win32 no cover diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py index b852a40d0..f2272cda8 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -137,7 +137,9 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: + (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else []) + (["TERM"] if stdout_is_atty else []) + (["TMP", "USERPROFILE"] if is_win else ["TMPDIR"]) - + ["VIRTUALENV_*", "http_proxy", "https_proxy", "no_proxy"] + + ["VIRTUALENV_*"] + + (["WINDIR"] if is_win else []) + + ["http_proxy", "https_proxy", "no_proxy"] ) assert pass_env == expected