From f10cf24e85f74cc78a1558b6a96dcea954da65b5 Mon Sep 17 00:00:00 2001 From: Clint Lawrence Date: Thu, 30 Oct 2025 10:34:59 +1100 Subject: [PATCH] Pass LOCALAPPDATA by default on Windows (#3639) --- docs/changelog/3639.bugfix.rst | 1 + docs/config.rst | 4 ++++ src/tox/tox_env/python/api.py | 1 + tests/session/cmd/test_show_config.py | 1 + 4 files changed, 7 insertions(+) create mode 100644 docs/changelog/3639.bugfix.rst diff --git a/docs/changelog/3639.bugfix.rst b/docs/changelog/3639.bugfix.rst new file mode 100644 index 0000000000..0cb2f34c86 --- /dev/null +++ b/docs/changelog/3639.bugfix.rst @@ -0,0 +1 @@ +Added 'LocalAppData' to the default passed environment variables on Windows. diff --git a/docs/config.rst b/docs/config.rst index a4e6a274a9..f65c970f01 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -504,6 +504,10 @@ Base options - ❌ - ❌ - ✅ + * - LOCALAPPDATA + - ❌ + - ❌ + - ✅ * - PROGRAMDATA - ❌ - ❌ diff --git a/src/tox/tox_env/python/api.py b/src/tox/tox_env/python/api.py index 8cf18364c4..3bf8622806 100644 --- a/src/tox/tox_env/python/api.py +++ b/src/tox/tox_env/python/api.py @@ -131,6 +131,7 @@ def _default_pass_env(self) -> list[str]: env.extend( [ "APPDATA", # Needed for PIP platformsdirs.windows + "LOCALAPPDATA", # Needed for pymanager "PROGRAMDATA", # needed for discovering the VS compiler "PROGRAMFILES(x86)", # needed for discovering the VS compiler "PROGRAMFILES", # needed for discovering the VS compiler diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py index d91939347b..2d06ecbf57 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -126,6 +126,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: + (["COMSPEC"] if is_win else []) + ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "FORCE_COLOR", "HOME", "LANG"] + ["LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"] + + (["LOCALAPPDATA"] if is_win else []) + (["MSYSTEM"] if is_win else []) + ["NETRC"] + (["NIX_LD", "NIX_LD_LIBRARY_PATH"] if not is_win else [])