mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-22 16:06:50 +00:00
fix Windows Docker sandbox path mounting (#1634)
* fix windows docker sandbox paths * fix windows sandbox mount validation * fix backend checks for windows sandbox path PR
This commit is contained in:
@@ -11,9 +11,16 @@ import pytest
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
SCRIPT_PATH = REPO_ROOT / "scripts" / "docker.sh"
|
||||
BASH_EXECUTABLE = which("bash") or r"C:\Program Files\Git\bin\bash.exe"
|
||||
BASH_CANDIDATES = [
|
||||
Path(r"C:\Program Files\Git\bin\bash.exe"),
|
||||
Path(which("bash")) if which("bash") else None,
|
||||
]
|
||||
BASH_EXECUTABLE = next(
|
||||
(str(path) for path in BASH_CANDIDATES if path is not None and path.exists() and "WindowsApps" not in str(path)),
|
||||
None,
|
||||
)
|
||||
|
||||
if not Path(BASH_EXECUTABLE).exists():
|
||||
if BASH_EXECUTABLE is None:
|
||||
pytestmark = pytest.mark.skip(reason="bash is required for docker.sh detection tests")
|
||||
|
||||
|
||||
@@ -21,13 +28,14 @@ def _detect_mode_with_config(config_content: str) -> str:
|
||||
"""Write config content into a temp project root and execute detect_sandbox_mode."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp_root = Path(tmpdir)
|
||||
(tmp_root / "config.yaml").write_text(config_content)
|
||||
(tmp_root / "config.yaml").write_text(config_content, encoding="utf-8")
|
||||
|
||||
command = f"source '{SCRIPT_PATH}' && PROJECT_ROOT='{tmp_root}' && detect_sandbox_mode"
|
||||
|
||||
output = subprocess.check_output(
|
||||
[BASH_EXECUTABLE, "-lc", command],
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
).strip()
|
||||
|
||||
return output
|
||||
@@ -37,7 +45,11 @@ def test_detect_mode_defaults_to_local_when_config_missing():
|
||||
"""No config file should default to local mode."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
command = f"source '{SCRIPT_PATH}' && PROJECT_ROOT='{tmpdir}' && detect_sandbox_mode"
|
||||
output = subprocess.check_output([BASH_EXECUTABLE, "-lc", command], text=True).strip()
|
||||
output = subprocess.check_output(
|
||||
[BASH_EXECUTABLE, "-lc", command],
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
).strip()
|
||||
|
||||
assert output == "local"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user