Skip to content

Commit 5a84d62

Browse files
committed
test: isolate path localization workspace environment
1 parent 30cfb1b commit 5a84d62

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎apodex/tests/test_features.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,19 @@ def test_gitignore_path_anchored_not_overpruned(tmp_path):
276276

277277

278278
# ── path localization (abs→rel avoids the ~50s sandbox slow path) ─────────
279-
def test_localize_absolute_path_inside_cwd(tmp_path):
279+
@pytest.mark.parametrize("workspace_mode", ["unset", "same", "symlink"])
280+
def test_localize_absolute_path_inside_cwd(tmp_path, monkeypatch, workspace_mode):
280281
cwd = str(tmp_path)
282+
# Localization is valid only when the runtime resolves paths in cwd.
283+
# Do not inherit a workspace configured by another test or the caller.
284+
monkeypatch.delenv("FRONTIER_AGENT_INPUTS_DIR", raising=False)
285+
monkeypatch.delenv("FRONTIER_AGENT_WORKSPACE_DIR", raising=False)
286+
if workspace_mode == "same":
287+
monkeypatch.setenv("FRONTIER_AGENT_WORKSPACE_DIR", cwd)
288+
elif workspace_mode == "symlink":
289+
workspace = tmp_path / "workspace-link"
290+
workspace.symlink_to(tmp_path, target_is_directory=True)
291+
monkeypatch.setenv("FRONTIER_AGENT_WORKSPACE_DIR", str(workspace))
281292
(tmp_path / "sub").mkdir()
282293
abspath = str(tmp_path / "sub" / "f.py")
283294
out = localize_path_args("read_file", {"path": abspath}, cwd)
@@ -294,6 +305,7 @@ def test_read_file_keeps_project_absolute_path_with_split_runtime_workspace(
294305
target = project / "README.md"
295306
target.write_text("# project\n")
296307

308+
monkeypatch.delenv("FRONTIER_AGENT_INPUTS_DIR", raising=False)
297309
monkeypatch.setenv(
298310
"FRONTIER_AGENT_WORKSPACE_DIR", str(runtime_workspace),
299311
)

0 commit comments

Comments
 (0)