from __future__ import annotations import runpy from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[3] SMOKE = runpy.run_path(ROOT / "scripts" / "smoke-python-runtime.py") @pytest.mark.parametrize( ("prompt_name", "expected"), [ ("SNAPSHOT_DIRECT_CHILD_PROMPT", "DIRECT_CHILD_OK"), ("SNAPSHOT_WORKFLOW_CHILD_PROMPT", "WORKFLOW_CHILD_OK"), ], ) def test_child_prompt_precedes_runtime_context(prompt_name: str, expected: str) -> None: chunks = SMOKE["completion_chunks"]({ "messages": [ {"role": "user", "content": SMOKE[prompt_name]}, {"role": "user", "content": "Current runtime context"}, ], }) assert any( choice.get("delta", {}).get("content") == expected for chunk in chunks for choice in chunk.get("choices", []) )