oclaw/tests/test_prompt_runtime_paths.py
oliver 420abac9f1 refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH
- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 14:51:17 +08:00

27 lines
847 B
Python

from __future__ import annotations
from runtime.memory_stage import render_memory_context_block
from runtime.types import OclawMemoryContext
from runtime.prompt_templates import render_runtime_prompt
def test_router_prompt_renders() -> None:
txt = render_runtime_prompt(
"router/decide_route.md",
variables={"user_text": "hi", "has_attachments": "no"},
strict=True,
)
assert "json" in txt.lower()
assert "sync_direct" in txt
assert "async_task" in txt
def test_memory_context_markdown_block() -> None:
ctx = OclawMemoryContext(
short_term=("用户想排查网络问题",),
semantic_hits=({"content": "上次 DNS 配置异常", "score": 0.91},),
)
out = render_memory_context_block(ctx)
assert "[short_term_digest]" in out
assert "[semantic_memory_hits]" in out