Files
xiaoxia-saas/tests/unit/test_agent_docs.py
T
xiaoxia 7da2a07a1a
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 25s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 40s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m14s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 1m46s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m23s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 33s
AI Code Review / AI Code Review (pull_request) Successful in 1m24s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m7s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 41s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 2m27s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 4m17s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 6m13s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Failing after 3m47s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m17s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) 失败: CI/CD Pipeline / Validate - Code Quality (pull_request), CI/CD Pipeline / Frontend Lint (pull_request), CI/CD Pipeline / PR Build Web Image (pull_request) [backend-only]
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 49s
fix(test): 修复test_agent_docs.py相对路径问题,从apps/api运行也能找到docs
使用 __file__ 定位项目根目录,避免依赖pytest运行目录。
修复后Unit Tests CI从apps/api目录运行也能正常通过。
2026-07-27 00:38:55 +08:00

36 lines
1.0 KiB
Python

from pathlib import Path
AGENT_DOCS = Path(__file__).parent.parent.parent / "docs" / "agents"
EXPECTED_AGENTS = [
"requirement_agent",
"arch_agent",
"code_dev_agent",
"lint_review_agent",
"test_agent",
"build_pack_agent",
"release_agent",
"ops_monitor_agent",
]
def test_agent_docs_use_canonical_eight_agents():
combined = "\n".join(path.read_text(encoding="utf-8") for path in AGENT_DOCS.rglob("*.md"))
for agent in EXPECTED_AGENTS:
assert agent in combined
def test_agent_runbook_defines_required_flow_order():
runbook = (AGENT_DOCS / "RUNBOOK.md").read_text(encoding="utf-8")
positions = [runbook.index(agent) for agent in EXPECTED_AGENTS]
assert positions == sorted(positions)
def test_auto_run_protocol_protects_openclaw_self_config_files():
protocol = (AGENT_DOCS / "AUTO-RUN-PROTOCOL.md").read_text(encoding="utf-8")
for filename in ["AGENTS.md", "SOUL.md", "MEMORY.md", "USER.md", "TOOLS.md", "META.md"]:
assert filename in protocol
assert "不得修改 OpenClaw" in protocol