From dd1b54f9719cd86b4698f0fcbc278875c0173253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Tue, 19 May 2026 14:15:48 -0600 Subject: [PATCH 1/2] feat: Also pass `TERMINFO` when in an interactive shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edgar Ramírez Mondragón --- docs/changelog/3946.feature.rst | 2 ++ src/tox/tox_env/api.py | 4 ++-- tests/conftest.py | 2 +- tests/session/cmd/test_show_config.py | 2 +- tests/test_provision.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 docs/changelog/3946.feature.rst 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/conftest.py b/tests/conftest.py index 53aeaf4787..27baf038f0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,9 +23,9 @@ if TYPE_CHECKING: from collections.abc import Callable, Iterator, Sequence - from build import DistributionType from pytest_mock import MockerFixture + from build import DistributionType from tox.config.loader.api import Override pytest_plugins = "tox.pytest" 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 []) diff --git a/tests/test_provision.py b/tests/test_provision.py index 74c27b9a34..8cba37b985 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -18,9 +18,9 @@ if TYPE_CHECKING: from collections.abc import Callable, Iterator, Sequence - from build import DistributionType from devpi_process import Index, IndexServer + from build import DistributionType from tox.execute.request import ExecuteRequest from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator From cb32d6f94877ed3a354901ef43dfd142b5057079 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 20:31:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/conftest.py | 2 +- tests/test_provision.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 27baf038f0..53aeaf4787 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,9 +23,9 @@ if TYPE_CHECKING: from collections.abc import Callable, Iterator, Sequence + from build import DistributionType from pytest_mock import MockerFixture - from build import DistributionType from tox.config.loader.api import Override pytest_plugins = "tox.pytest" diff --git a/tests/test_provision.py b/tests/test_provision.py index 8cba37b985..74c27b9a34 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -18,9 +18,9 @@ if TYPE_CHECKING: from collections.abc import Callable, Iterator, Sequence + from build import DistributionType from devpi_process import Index, IndexServer - from build import DistributionType from tox.execute.request import ExecuteRequest from tox.pytest import MonkeyPatch, TempPathFactory, ToxProjectCreator