diff --git a/docs/changelog/3171.feature.rst b/docs/changelog/3171.feature.rst new file mode 100644 index 0000000000..1527d0f4fe --- /dev/null +++ b/docs/changelog/3171.feature.rst @@ -0,0 +1 @@ +Always ``PY_COLORS`` to the environment diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py index 45bbc5ce1c..2be6fb85c4 100644 --- a/src/tox/tox_env/api.py +++ b/src/tox/tox_env/api.py @@ -219,6 +219,7 @@ def _default_pass_env(self) -> list[str]: "LD_LIBRARY_PATH", # location of libs "LDFLAGS", # linker flags "HOME", # needed for `os.path.expanduser()` on non-Windows systems + "PY_COLORS", # Popular way to force color output in CI ] if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM env.append("TERM") diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py index f5829294b1..8a913e7f55 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -130,6 +130,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: + (["PROGRAMDATA"] if is_win else []) + (["PROGRAMFILES"] if is_win else []) + (["PROGRAMFILES(x86)"] if is_win else []) + + (["PY_COLORS"]) + ["REQUESTS_CA_BUNDLE", "SSL_CERT_FILE"] + (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else []) + (["TERM"] if stdout_is_atty else [])