From 51c01062d4a2e3cdccc1fb1fdf712dd44fd18e2a Mon Sep 17 00:00:00 2001 From: xxxigm Date: Thu, 2 Jul 2026 08:14:28 +0700 Subject: [PATCH] test(terminal): cover MSYS_NO_PATHCONV defaults on Windows env builders --- tests/tools/test_local_env_windows_msys.py | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/tools/test_local_env_windows_msys.py b/tests/tools/test_local_env_windows_msys.py index 1b05aaaea..09bd09e27 100644 --- a/tests/tools/test_local_env_windows_msys.py +++ b/tests/tools/test_local_env_windows_msys.py @@ -24,9 +24,12 @@ from unittest.mock import patch from tools.environments import local as local_mod from tools.environments.local import ( LocalEnvironment, + _make_run_env, _msys_to_windows_path, _resolve_safe_cwd, + _sanitize_subprocess_env, _windows_to_msys_path, + hermes_subprocess_env, ) @@ -228,6 +231,36 @@ class TestExtractCwdFromOutputWindowsMsys: assert env.cwd == str(new_dir) +# --------------------------------------------------------------------------- +# MSYS_NO_PATHCONV — native Windows command flags (#56700) +# --------------------------------------------------------------------------- + +class TestWindowsMsysPathconvDefaults: + def test_make_run_env_sets_msys_no_pathconv_on_windows(self, monkeypatch): + monkeypatch.setattr(local_mod, "_IS_WINDOWS", True) + run_env = _make_run_env({}) + assert run_env.get("MSYS_NO_PATHCONV") == "1" + + def test_sanitize_subprocess_env_sets_msys_no_pathconv_on_windows(self, monkeypatch): + monkeypatch.setattr(local_mod, "_IS_WINDOWS", True) + env = _sanitize_subprocess_env({}) + assert env.get("MSYS_NO_PATHCONV") == "1" + + def test_hermes_subprocess_env_sets_msys_no_pathconv_on_windows(self, monkeypatch): + monkeypatch.setattr(local_mod, "_IS_WINDOWS", True) + env = hermes_subprocess_env() + assert env.get("MSYS_NO_PATHCONV") == "1" + + def test_no_pathconv_not_set_on_posix(self, monkeypatch): + monkeypatch.setattr(local_mod, "_IS_WINDOWS", False) + assert "MSYS_NO_PATHCONV" not in _make_run_env({}) + + def test_respects_user_override(self, monkeypatch): + monkeypatch.setattr(local_mod, "_IS_WINDOWS", True) + run_env = _make_run_env({"MSYS_NO_PATHCONV": "0"}) + assert run_env.get("MSYS_NO_PATHCONV") == "0" + + # --------------------------------------------------------------------------- # Command wrapping — native Windows cwd must be Git Bash-friendly for cd # ---------------------------------------------------------------------------