mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
同步 agent/project context 基线测试到 runtime/workspaces 根路径约定。
将测试样例路径从旧的 oclaw/runtime/workspaces 迁移到当前 PROJECT_ROOT/runtime/workspaces,保持 bootstrap 与 role context 读取断言与实现一致。 Made-with: Cursor
This commit is contained in:
parent
24bf6e8eaf
commit
09836dddfa
2 changed files with 8 additions and 8 deletions
|
|
@ -13,7 +13,7 @@ def _set_project_root(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
|||
|
||||
def test_build_role_system_context_reads_runtime_workspaces(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
||||
_set_project_root(monkeypatch, tmp_path)
|
||||
ws = tmp_path / "oclaw" / "runtime" / "workspaces" / "main"
|
||||
ws = tmp_path / "runtime" / "workspaces" / "main"
|
||||
ws.mkdir(parents=True, exist_ok=True)
|
||||
(ws / "SOUL.md").write_text("main soul", encoding="utf-8")
|
||||
(ws / "ROLE_SYSTEM.md").write_text("main role system", encoding="utf-8")
|
||||
|
|
@ -28,7 +28,7 @@ def test_build_role_system_context_cache_invalidates_on_file_change(
|
|||
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
) -> None:
|
||||
_set_project_root(monkeypatch, tmp_path)
|
||||
ws = tmp_path / "oclaw" / "runtime" / "workspaces" / "ops"
|
||||
ws = tmp_path / "runtime" / "workspaces" / "ops"
|
||||
ws.mkdir(parents=True, exist_ok=True)
|
||||
role_file = ws / "ROLE_SYSTEM.md"
|
||||
role_file.write_text("v1", encoding="utf-8")
|
||||
|
|
@ -41,7 +41,7 @@ def test_build_role_system_context_cache_invalidates_on_file_change(
|
|||
|
||||
def test_build_role_system_context_renders_template_vars(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
||||
_set_project_root(monkeypatch, tmp_path)
|
||||
ws = tmp_path / "oclaw" / "runtime" / "workspaces" / "ops"
|
||||
ws = tmp_path / "runtime" / "workspaces" / "ops"
|
||||
ws.mkdir(parents=True, exist_ok=True)
|
||||
(ws / "ROLE_SYSTEM.md").write_text("experts={{EXPERTS_HINT}}", encoding="utf-8")
|
||||
out = loader_mod.build_role_system_context("ops", template_vars={"EXPERTS_HINT": "ops,generalist"})
|
||||
|
|
@ -52,7 +52,7 @@ def test_build_role_system_context_template_var_isolated_by_cache_key(
|
|||
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
) -> None:
|
||||
_set_project_root(monkeypatch, tmp_path)
|
||||
ws = tmp_path / "oclaw" / "runtime" / "workspaces" / "ops"
|
||||
ws = tmp_path / "runtime" / "workspaces" / "ops"
|
||||
ws.mkdir(parents=True, exist_ok=True)
|
||||
(ws / "ROLE_SYSTEM.md").write_text("x={{A}}", encoding="utf-8")
|
||||
a = loader_mod.build_role_system_context("ops", template_vars={"A": "one"})
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class _Store:
|
|||
|
||||
|
||||
def test_build_project_context_block_reads_workspace_bootstrap(monkeypatch, tmp_path: Path) -> None:
|
||||
ws = tmp_path / "oclaw" / "runtime" / "workspaces" / "main"
|
||||
ws = tmp_path / "runtime" / "workspaces" / "main"
|
||||
ws.mkdir(parents=True, exist_ok=True)
|
||||
(ws / "TOOLS.md").write_text("tooling note", encoding="utf-8")
|
||||
monkeypatch.setattr("oclaw.runtime.project_context_prompt.PROJECT_ROOT", tmp_path)
|
||||
|
|
@ -38,7 +38,7 @@ def test_build_project_context_block_fallback_to_project_root(monkeypatch, tmp_p
|
|||
|
||||
|
||||
def test_build_project_context_block_triggers_bootstrap_for_each_root(monkeypatch, tmp_path: Path) -> None:
|
||||
ws_agent = tmp_path / "oclaw" / "runtime" / "workspaces" / "main"
|
||||
ws_agent = tmp_path / "runtime" / "workspaces" / "main"
|
||||
ws_agent.mkdir(parents=True, exist_ok=True)
|
||||
(ws_agent / "TOOLS.md").write_text("agent root", encoding="utf-8")
|
||||
monkeypatch.setattr("oclaw.runtime.project_context_prompt.PROJECT_ROOT", tmp_path)
|
||||
|
|
@ -62,8 +62,8 @@ def test_build_project_context_block_triggers_bootstrap_for_each_root(monkeypatc
|
|||
|
||||
|
||||
def test_project_context_bootstrap_includes_agent_id_when_config_matches(monkeypatch, tmp_path: Path) -> None:
|
||||
ws_agent = tmp_path / "oclaw" / "runtime" / "workspaces" / "main"
|
||||
ws_social = tmp_path / "oclaw" / "workspace-social"
|
||||
ws_agent = tmp_path / "runtime" / "workspaces" / "main"
|
||||
ws_social = tmp_path / "workspace-social"
|
||||
ws_agent.mkdir(parents=True, exist_ok=True)
|
||||
ws_social.mkdir(parents=True, exist_ok=True)
|
||||
(ws_agent / "TOOLS.md").write_text("agent root", encoding="utf-8")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue