diff --git a/docs/changelog/3946.feature.rst b/docs/changelog/3946.feature.rst new file mode 100644 index 0000000000..7a7c52d655 --- /dev/null +++ b/docs/changelog/3946.feature.rst @@ -0,0 +1,2 @@ +Automatically pass the TERMINFO environment variable to tox subprocesses if the output is a TTY. This variable is used +by Ghostty to communicate terminal capabilities to programs. diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py index d03f0cf3bd..0f58c0f792 100644 --- a/src/tox/tox_env/api.py +++ b/src/tox/tox_env/api.py @@ -235,8 +235,8 @@ def _default_pass_env(self) -> list[str]: # noqa: PLR6301 "NETRC", # used by pip and netrc modules "PYTHON_GIL", # allows controlling python gil ] - if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM - env.append("TERM") + if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM and TERMINFO + env.extend(("TERM", "TERMINFO")) # needed when TERM isn't in system terminfo db if sys.platform == "win32": # pragma: win32 cover env.extend( [ diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py index 373fd111d3..711a4e2646 100644 --- a/tests/session/cmd/test_show_config.py +++ b/tests/session/cmd/test_show_config.py @@ -207,7 +207,7 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty: + (["SSH_AGENT_PID", "SSH_AUTH_SOCK"] if not is_win else []) + ["SSL_CERT_FILE"] + (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else []) - + (["TERM"] if stdout_is_atty else []) + + (["TERM", "TERMINFO"] if stdout_is_atty else []) + (["TMP", "USERPROFILE"] if is_win else ["TMPDIR"]) + ["VIRTUALENV_*"] + (["WINDIR"] if is_win else [])