52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(REPO_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(REPO_ROOT))
|
|
|
|
from scripts.deploy_adapters import default_codex_home, deploy_codex
|
|
|
|
|
|
def test_default_codex_home_is_external_to_project(tmp_path: Path) -> None:
|
|
home = default_codex_home(env={}, user_home=tmp_path)
|
|
|
|
assert home == tmp_path / ".codex"
|
|
assert not home.is_relative_to(REPO_ROOT)
|
|
|
|
|
|
def test_deploy_codex_writes_adapter_to_external_home(tmp_path: Path) -> None:
|
|
target = tmp_path / "codex-home"
|
|
|
|
result = deploy_codex(target=target, force=True, repo_root=REPO_ROOT)
|
|
|
|
assert result.written
|
|
assert not (target / "config.toml").exists()
|
|
assert (target / "commands" / "dr-run.md").exists()
|
|
assert (target / "agents" / "dr-pm.toml").exists()
|
|
assert (target / "skills" / "search-strategy" / "SKILL.md").exists()
|
|
assert (target / "skills" / "search-gateway" / "SKILL.md").exists()
|
|
assert (target / "skills" / "document-ingest" / "SKILL.md").exists()
|
|
assert (target / "skills" / "deep-research" / "SKILL.md").exists()
|
|
assert result.target == target
|
|
|
|
|
|
def test_deploy_codex_config_is_explicit_opt_in(tmp_path: Path) -> None:
|
|
target = tmp_path / "codex-home"
|
|
|
|
result = deploy_codex(target=target, force=True, repo_root=REPO_ROOT, include_config=True)
|
|
|
|
assert result.written
|
|
assert (target / "config.toml").exists()
|
|
|
|
|
|
def test_deploy_codex_dry_run_does_not_write(tmp_path: Path) -> None:
|
|
target = tmp_path / "codex-home"
|
|
|
|
result = deploy_codex(target=target, force=True, repo_root=REPO_ROOT, dry_run=True)
|
|
|
|
assert result.planned
|
|
assert not target.exists()
|