From 7818b3d55fadef6fc881e66bc58626e9f6832c34 Mon Sep 17 00:00:00 2001 From: Niander Assis <4544122+niander@users.noreply.github.com> Date: Wed, 20 Apr 2022 02:08:35 -0700 Subject: [PATCH] Adding APPDATA as default passenv on Windows (#2404) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CONTRIBUTORS | 1 + docs/changelog/2402.bugfix.rst | 1 + docs/config.rst | 2 +- src/tox/config/__init__.py | 1 + tests/unit/config/test_config.py | 2 ++ 5 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2402.bugfix.rst diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f12b86f2c..feb454c9f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -92,6 +92,7 @@ Miro HronĨok Monty Taylor Morgan Fainberg Naveen S R +Niander Assis Nick Douma Nick Prendergast Nicolas Vivet diff --git a/docs/changelog/2402.bugfix.rst b/docs/changelog/2402.bugfix.rst new file mode 100644 index 000000000..25f5d724e --- /dev/null +++ b/docs/changelog/2402.bugfix.rst @@ -0,0 +1 @@ +``sitepackages = true`` will add user's site-package to the python path on Windows as expected -- by :user:`niander` diff --git a/docs/config.rst b/docs/config.rst index 2ca82e3a8..67bdb66b8 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -468,7 +468,7 @@ Complete list of settings that you can put into ``testenv*`` sections: ``LD_LIBRARY_PATH``, ``PIP_INDEX_URL``, ``PIP_EXTRA_INDEX_URL``, ``REQUESTS_CA_BUNDLE``, ``SSL_CERT_FILE``, ``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY`` - * Windows: ``SYSTEMDRIVE``, ``SYSTEMROOT``, ``PATHEXT``, ``TEMP``, ``TMP`` + * Windows: ``APPDATA``, ``SYSTEMDRIVE``, ``SYSTEMROOT``, ``PATHEXT``, ``TEMP``, ``TMP`` ``NUMBER_OF_PROCESSORS``, ``USERPROFILE``, ``MSYSTEM``, ``PROGRAMFILES``, ``PROGRAMFILES(X86)``, ``PROGRAMDATA`` * Others (e.g. UNIX, macOS): ``TMPDIR`` diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py index b49c06f6d..24f669d37 100644 --- a/src/tox/config/__init__.py +++ b/src/tox/config/__init__.py @@ -796,6 +796,7 @@ def passenv(testenv_config, value): # but this leads to very long paths when run with jenkins # so we just pass it on by default for now. if tox.INFO.IS_WIN: + passenv.add("APPDATA") # needed to find user site-packages location passenv.add("SYSTEMDRIVE") # needed for pip6 passenv.add("SYSTEMROOT") # needed for python's crypto module passenv.add("PATHEXT") # needed for discovering executables diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 3408de02a..b1a72b44c 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -1508,6 +1508,7 @@ def test_passenv_as_multiline_list(self, newconfig, monkeypatch, plat): assert len(config.envconfigs) == 1 envconfig = config.envconfigs["python"] if plat == "win32": + assert "APPDATA" in envconfig.passenv assert "PATHEXT" in envconfig.passenv assert "SYSTEMDRIVE" in envconfig.passenv assert "SYSTEMROOT" in envconfig.passenv @@ -1560,6 +1561,7 @@ def test_passenv_as_space_separated_list(self, newconfig, monkeypatch, plat): assert len(config.envconfigs) == 1 envconfig = config.envconfigs["python"] if plat == "win32": + assert "APPDATA" in envconfig.passenv assert "PATHEXT" in envconfig.passenv assert "SYSTEMDRIVE" in envconfig.passenv assert "SYSTEMROOT" in envconfig.passenv