feat: add pytest tests for piper plugin

Add 15 test cases covering manifest validation, monkey-patch logic,
idempotency, error handling, lifecycle hooks, and plugin registration.

Update README with test instructions and corrected install URL.
This commit is contained in:
Paul @ TD NDE
2026-05-25 00:03:36 -04:00
parent b0ac1aec74
commit c44e65e381
2 changed files with 315 additions and 1 deletions

View File

@@ -27,12 +27,29 @@ import is safe. The plugin also logs the effective default at session start.
# 1. Ensure piper-tts is installed
pip install piper-tts
# 2. Install the plugin from Gitea
# 2. Install the plugin from the internal Hermes repo
hermes plugins install ssh://git@code.lazyworkhorse.net:2222/Hermes/hermes-piper-plugin.git
# 3. Restart gateways to load the plugin
```
## Testing
```bash
cd /opt/data/projects/hermes-piper-plugin
pip install pytest pyyaml
python -m pytest tests/ -v
```
Tests cover:
- **Manifest validation** — confirms plugin.yaml structure and required fields
- **Monkey-patch logic** — verifies DEFAULT_PROVIDER is changed to 'piper'
- **Idempotency** — calling `_apply_piper_patch()` twice is safe
- **Error handling** — import failures and exceptions are caught gracefully
- **Lifecycle hooks** — on_session_start fires without errors
- **Plugin registration** — register() wires tools, hooks, and logging correctly
## Config
The plugin changes the **default** provider. You can still override per