Pytest plugin + helpers for testing Anna Executa stdio JSON-RPC plugins.
Project description
anna-executa-test
Pytest plugin and helpers for testing Anna Executa stdio JSON-RPC tool plugins.
Companion to @anna/cli and @anna/app-test — covers the plugin side of
an Anna App while @anna/app-test covers the bundle side.
Install
uv pip install anna-executa-test
# or
pip install anna-executa-test
Usage
Drop a tests/test_smoke.py next to your plugin:
from pathlib import Path
import pytest
from anna_executa_test import describe_plugin, executa, assert_jsonrpc_ok
PLUGIN_DIR = Path(__file__).parent.parent
@pytest.fixture(scope="module")
def plugin():
with executa.spawn(PLUGIN_DIR) as p:
yield p
def test_describe(plugin):
info = plugin.call("describe")
assert info["name"].startswith("tool-")
assert info["tools"], "plugin should declare at least one tool"
def test_invoke_get_state(plugin):
resp = plugin.call("invoke", {"tool": "session", "arguments": {"action": "get_state"}})
assert resp["success"] is True
Public API (Phase 5 MVP)
executa.spawn(project_dir, *, command=None, env=None)— context manager spawning the plugin underuv run. ReturnsExecutaClient.ExecutaClient.call(method, params=None, *, timeout=10.0)— one JSON-RPC request/response round-trip.ExecutaClient.invoke(tool, arguments)— sugar for the common case.ExecutaClient.describe()/.health()— sugar for the standard control methods.assert_jsonrpc_ok(resp)/assert_jsonrpc_error(resp, code=...)wire_format.validate_response(env)— strict envelope shape check matchingnexus.executa_wire.contract.contract_for(project_dir)— readpyproject.toml+ spawn briefly to captureMANIFEST; exposes.parametrize_invoke(...).mock_state_dir(tmp_path)— pytest fixture overridingXDG_STATE_HOMEand friends.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anna_executa_test-0.1.1.tar.gz.
File metadata
- Download URL: anna_executa_test-0.1.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a33412a14107dcfd598d20ff1f5a463c3a60b15f9ca901f773ee91aaaa66eaf
|
|
| MD5 |
c34dc1738699c5b072212ab6ac56a194
|
|
| BLAKE2b-256 |
5d452233aa4b4c0c3d7a37fe8b4594a35a10430463dcef27de1604c077cb473b
|
File details
Details for the file anna_executa_test-0.1.1-py3-none-any.whl.
File metadata
- Download URL: anna_executa_test-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d1b1ab983ae6f65b32f2a8969a16d8a41d46da172da8280960f96c1aa7b8725
|
|
| MD5 |
7e1c84739b22b615c8e5274c76907584
|
|
| BLAKE2b-256 |
bd25bb50f0c60d494f65e8298786275431a7b839937ea6d77ea59c9d80de9af6
|