Skip to content

The agent that grows with you

fix(test): pin config set's refusal of an invalid list literal

teknium1aca2631d9508
diff --git a/tests/hermes_cli/test_config_set_list_values.py b/tests/hermes_cli/test_config_set_list_values.py
index 022f13ae08c..2ee932618cf 100644
--- a/tests/hermes_cli/test_config_set_list_values.py
+++ b/tests/hermes_cli/test_config_set_list_values.py
@@ -49,14 +49,16 @@ def test_yaml_flow_list_is_parsed(user_home):
assert raw["plugins"]["enabled"] == ["model-providers/gemini"]
-def test_invalid_list_literal_warns_and_stores_string(user_home, capsys):
+def test_invalid_list_literal_is_refused_and_nothing_written(user_home, capsys):
+ # Was warn-and-store: every isinstance-gated reader ignored the string while
+ # `config get` echoed it back (#114471). The writer now refuses the literal.
from hermes_cli.config import set_config_value, read_raw_config
- set_config_value("platform_toolsets.line", '["unclosed')
+ with pytest.raises(SystemExit):
+ set_config_value("platform_toolsets.line", '["unclosed')
captured = capsys.readouterr()
- assert "not valid" in captured.err.lower() or "warning" in captured.err.lower()
- raw = read_raw_config()
- assert raw["platform_toolsets"]["line"] == '["unclosed'
+ assert "not valid yaml/json" in captured.err.lower()
+ assert "platform_toolsets" not in (read_raw_config() or {})
def test_scalar_values_unaffected(user_home):