Files
agent-zero/tests/test_promptinclude.py
Jan Tomášek 188cff2073 Move optional runtimes into persistent gVisor plugin sandboxes
Move tunnel, browser, document, speech and integration runtimes into plugin-owned
sandboxes with lazy dependencies and instance-scoped lifecycle management.
Reuse Tuxee display assets and the sandbox image's Python/Node runtimes, enable
automatic Desktop login, and show elapsed time for each browser launch.

Slim the outer image, use offline ONNX embeddings, and calculate sandbox storage
only on demand. Include regression coverage and updated runtime documentation.
Exclude local handoff notes and temporary verification artifacts from publication.
2026-11-08 21:43:22 +01:00

51 lines
1.4 KiB
Python

from types import SimpleNamespace
import pytest
from helpers import runtime
from plugins._promptinclude.extensions.python.system_prompt import _16_promptinclude
from plugins._promptinclude.helpers.scanner import scan_promptinclude_files
def test_scanner_ignores_empty_matching_files(tmp_path) -> None:
(tmp_path / "empty.promptinclude.md").write_text(" \n", encoding="utf-8")
assert scan_promptinclude_files(str(tmp_path)) == {
"files": [],
"skipped_count": 0,
}
@pytest.mark.asyncio
async def test_promptinclude_stays_discoverable_without_matching_files(
monkeypatch, tmp_path
) -> None:
class Agent:
context = SimpleNamespace()
def read_prompt(self, name, **kwargs):
assert name == "agent.system.promptinclude.md"
return f"{kwargs['name_pattern']}|{kwargs['includes']}"
def no_dispatch(*args, **kwargs):
raise AssertionError("Prompt inclusion must scan locally")
monkeypatch.setattr(
_16_promptinclude.plugins,
"get_plugin_config",
lambda *_args, **_kwargs: {},
)
monkeypatch.setattr(
_16_promptinclude, "_resolve_workdir", lambda _agent: str(tmp_path)
)
monkeypatch.setattr(
runtime, "call_development_function", no_dispatch
)
system_prompt: list[str] = []
await _16_promptinclude.PromptInclude(Agent()).execute(
system_prompt=system_prompt
)
assert system_prompt == ["*.promptinclude.md|"]