Skip to content

The agent that grows with you

test: use canonical YAML helpers in plugin fixtures

ethernet018623687278
diff --git a/tests/hermes_cli/test_config_yaml_comment_preservation.py b/tests/hermes_cli/test_config_yaml_comment_preservation.py
index fa27441423f..45ce2f1dbae 100644
--- a/tests/hermes_cli/test_config_yaml_comment_preservation.py
+++ b/tests/hermes_cli/test_config_yaml_comment_preservation.py
@@ -13,7 +13,7 @@ from pathlib import Path
from unittest.mock import patch
import pytest
-import yaml
+import hermes_yaml as yaml
REPO = Path(__file__).resolve().parents[2]
diff --git a/tests/hermes_cli/test_plugin_manifest_v2.py b/tests/hermes_cli/test_plugin_manifest_v2.py
index 6b5e2c7dcd7..282cfe17839 100644
--- a/tests/hermes_cli/test_plugin_manifest_v2.py
+++ b/tests/hermes_cli/test_plugin_manifest_v2.py
@@ -544,7 +544,7 @@ class TestBundledKeyShadowing:
_write_plugin(home / "plugins", "impostor_dir", manifest_extra={"name": "genuine"},
register_body="import sys; sys._shadow_probe = 'impostor'")
(home / "plugins" / "impostor_dir" / "plugin.yaml").write_text(
- yaml.dump({"name": "genuine", "version": "0.1.0", "description": "impostor"}))
+ yaml.safe_dump({"name": "genuine", "version": "0.1.0", "description": "impostor"}))
_write_plugin(home / "plugins", "overridable", register_body="import sys; sys._override_probe = 'user'")
_enable(home, ["genuine", "overridable"])
import sys
diff --git a/tests/hermes_cli/test_plugin_scanner_recursion.py b/tests/hermes_cli/test_plugin_scanner_recursion.py
index 9c1eeb21953..1c5806cd7bf 100644
--- a/tests/hermes_cli/test_plugin_scanner_recursion.py
+++ b/tests/hermes_cli/test_plugin_scanner_recursion.py
@@ -132,7 +132,7 @@ class TestForeignHarnessManifestDirs:
sp = hermes_home / "plugins" / "superpowers"
(sp / ".hermes-plugin").mkdir(parents=True)
(sp / ".hermes-plugin" / "plugin.yaml").write_text(
- yaml.dump(
+ yaml.safe_dump(
{
"name": "superpowers",
"version": "6.3.0",
diff --git a/tests/hermes_cli/test_plugins.py b/tests/hermes_cli/test_plugins.py
index 002e1845393..4782712e0d2 100644
--- a/tests/hermes_cli/test_plugins.py
+++ b/tests/hermes_cli/test_plugins.py
@@ -563,7 +563,7 @@ class TestPluginLoading:
bundled = tmp_path / "bundled"
chronos = bundled / "cron_providers" / "chronos"
chronos.mkdir(parents=True)
- (chronos / "plugin.yaml").write_text(yaml.dump({"name": "chronos"}), encoding="utf-8")
+ (chronos / "plugin.yaml").write_text(yaml.safe_dump({"name": "chronos"}), encoding="utf-8")
(chronos / "__init__.py").write_text(
"def register(ctx):\n ctx.register_cron_scheduler(object())\n", encoding="utf-8")
hermes_home = tmp_path / "hermes_test"
@@ -584,7 +584,7 @@ class TestPluginLoading:
hermes_home = tmp_path / "hermes_test"
plugin_dir = hermes_home / "plugins" / "mycron"
plugin_dir.mkdir(parents=True)
- (plugin_dir / "plugin.yaml").write_text(yaml.dump({"name": "mycron"}), encoding="utf-8")
+ (plugin_dir / "plugin.yaml").write_text(yaml.safe_dump({"name": "mycron"}), encoding="utf-8")
(plugin_dir / "__init__.py").write_text(
"def register(ctx):\n ctx.register_cron_scheduler(object())\n", encoding="utf-8")
(hermes_home / "config.yaml").write_text(yaml.safe_dump({"plugins": {"enabled": ["mycron"]}}))
diff --git a/tests/hermes_cli/test_plugins_cmd_remove_bookkeeping.py b/tests/hermes_cli/test_plugins_cmd_remove_bookkeeping.py
index f226ae09f8d..8300615188c 100644
--- a/tests/hermes_cli/test_plugins_cmd_remove_bookkeeping.py
+++ b/tests/hermes_cli/test_plugins_cmd_remove_bookkeeping.py
@@ -7,7 +7,7 @@ Real removal core against a temp HERMES_HOME; the RPC path goes through ``tui_ga
from __future__ import annotations
import pytest
-import yaml
+import hermes_yaml as yaml
from hermes_cli import plugins_cmd
from tui_gateway import server
diff --git a/tests/plugins/test_security_guidance_plugin.py b/tests/plugins/test_security_guidance_plugin.py
index 73b669fb0ba..4f9983edc8e 100644
--- a/tests/plugins/test_security_guidance_plugin.py
+++ b/tests/plugins/test_security_guidance_plugin.py
@@ -264,7 +264,7 @@ class TestPreToolCallHook:
class TestPluginDiscovery:
def test_manifest_declares_registered_hooks(self):
"""Manifest metadata must use the field consumed by plugin discovery."""
- import yaml
+ import hermes_yaml as yaml
plugin_dir = _repo_root() / "plugins" / "security-guidance"
manifest = yaml.safe_load(