From 8aa94b160f700f2ce419bdd4e29a3992df52ed7a Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Sun, 30 Jun 2024 07:24:03 -0500 Subject: [PATCH] Add `windir` to the default list of Windows `pass_env` variables Fixes #3302 --- docs/changelog/3302.bugfix.rst | 1 + src/tox/tox_env/api.py | 1 + tests/session/cmd/test_show_config.py | 1 + 3 files changed, 3 insertions(+) create mode 100644 docs/changelog/3302.bugfix.rst diff --git a/docs/changelog/3302.bugfix.rst b/docs/changelog/3302.bugfix.rst new file mode 100644 index 0000000000..99249b6ccf --- /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 260252a68f..b98ad3b0aa 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 b852a40d09..f527bf3337 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -138,6 +138,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: + (["TERM"] if stdout_is_atty else []) + (["TMP", "USERPROFILE"] if is_win else ["TMPDIR"]) + ["VIRTUALENV_*", "http_proxy", "https_proxy", "no_proxy"] + + (["WINDIR"] if is_win else []) ) assert pass_env == expected