fix(tests): Sandbox isolation - use SLOP_CONFIG env var for config.toml
This commit is contained in:
@@ -184,13 +184,15 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
|
|||||||
shutil.rmtree(temp_workspace)
|
shutil.rmtree(temp_workspace)
|
||||||
temp_workspace.mkdir(parents=True, exist_ok=True)
|
temp_workspace.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Create dummy config and project files to avoid cluttering root
|
# Create minimal project files to avoid cluttering root
|
||||||
(temp_workspace / "config.toml").write_text("[projects]\npaths = []\nactive = ''\n", encoding="utf-8")
|
# 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 / "manual_slop.toml").write_text("[project]\nname = 'TestProject'\n", encoding="utf-8")
|
||||||
(temp_workspace / "conductor" / "tracks").mkdir(parents=True, exist_ok=True)
|
(temp_workspace / "conductor" / "tracks").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Resolve absolute paths for shared resources
|
# 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"
|
cred_file = project_root / "credentials.toml"
|
||||||
mcp_file = project_root / "mcp_env.toml"
|
mcp_file = project_root / "mcp_env.toml"
|
||||||
|
|
||||||
@@ -215,6 +217,8 @@ def live_gui() -> Generator[tuple[subprocess.Popen, str], None, None]:
|
|||||||
# or just run from that CWD.
|
# or just run from that CWD.
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["PYTHONPATH"] = str(project_root.absolute())
|
env["PYTHONPATH"] = str(project_root.absolute())
|
||||||
|
if config_file.exists():
|
||||||
|
env["SLOP_CONFIG"] = str(config_file.absolute())
|
||||||
if cred_file.exists():
|
if cred_file.exists():
|
||||||
env["SLOP_CREDENTIALS"] = str(cred_file.absolute())
|
env["SLOP_CREDENTIALS"] = str(cred_file.absolute())
|
||||||
if mcp_file.exists():
|
if mcp_file.exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user