mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 12:43:16 +00:00
create_local_sandbox now mkdir -p's the resolved root dir, so a custom LOCAL_SANDBOX_ROOT_DIR (or a /tmp path cleared on reboot) no longer fails sandbox work-dir resolution.
29 lines
967 B
Python
29 lines
967 B
Python
import agent.integrations.local as local_mod
|
|
|
|
|
|
class _StubLocalShellBackend:
|
|
def __init__(self, *, root_dir, inherit_env):
|
|
self.root_dir = root_dir
|
|
self.inherit_env = inherit_env
|
|
|
|
|
|
def test_create_local_sandbox_creates_missing_root_dir(monkeypatch, tmp_path):
|
|
root = tmp_path / "nested" / "openswe-sandbox"
|
|
monkeypatch.setenv("LOCAL_SANDBOX_ROOT_DIR", str(root))
|
|
monkeypatch.setattr(local_mod, "LocalShellBackend", _StubLocalShellBackend)
|
|
|
|
backend = local_mod.create_local_sandbox()
|
|
|
|
assert root.is_dir()
|
|
assert backend.root_dir == str(root)
|
|
assert backend.inherit_env is True
|
|
|
|
|
|
def test_create_local_sandbox_defaults_to_cwd(monkeypatch, tmp_path):
|
|
monkeypatch.delenv("LOCAL_SANDBOX_ROOT_DIR", raising=False)
|
|
monkeypatch.chdir(tmp_path)
|
|
monkeypatch.setattr(local_mod, "LocalShellBackend", _StubLocalShellBackend)
|
|
|
|
backend = local_mod.create_local_sandbox()
|
|
|
|
assert backend.root_dir == str(tmp_path)
|