fix(tests): Sandbox isolation - use SLOP_CONFIG env var for config.toml

This commit is contained in:
2026-03-04 17:12:36 -05:00
parent 817a453ec9
commit 88aefc2f08

View File

@@ -184,16 +184,18 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
shutil.rmtree(temp_workspace)
temp_workspace.mkdir(parents=True, exist_ok=True)
# Create dummy config and project files to avoid cluttering root
(temp_workspace / "config.toml").write_text("[projects]\npaths = []\nactive = ''\n", encoding="utf-8")
# Create minimal project files to avoid cluttering root
# NOTE: Do NOT create config.toml here - we use SLOP_CONFIG env var
# to point to the actual project root config.toml
(temp_workspace / "manual_slop.toml").write_text("[project]\nname = 'TestProject'\n", encoding="utf-8")
(temp_workspace / "conductor" / "tracks").mkdir(parents=True, exist_ok=True)
# Resolve absolute paths for shared resources
project_root = Path(os.getcwd())
project_root = Path(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
config_file = project_root / "config.toml"
cred_file = project_root / "credentials.toml"
mcp_file = project_root / "mcp_env.toml"
# Preserve GUI layout for tests
layout_file = Path("manualslop_layout.ini")
if layout_file.exists():
@@ -215,6 +217,8 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
# or just run from that CWD.
env = os.environ.copy()
env["PYTHONPATH"] = str(project_root.absolute())
if config_file.exists():
env["SLOP_CONFIG"] = str(config_file.absolute())
if cred_file.exists():
env["SLOP_CREDENTIALS"] = str(cred_file.absolute())
if mcp_file.exists():