2b969c1994
- Register plugin command in CLI main.py imports and add_typer calls - Add plugin to valid_cmds list in main() to prevent "Invalid command" error - Remove unused PluginNotFoundError import from plugin.py (F401 lint fix) - Fix line too long in plugin.py _print_plugin function (E501 lint fix) - Fix list_plugins to output JSON even when no plugins installed - Remove duplicate step definitions from plugin_cli_steps.py that conflicted with existing steps (I run, output should contain, output should be valid JSON) - Rewrite plugin_cli.feature to test error cases that don't require pre-registered plugins (since PluginManager is not a singleton across CLI invocations)
19 lines
523 B
Python
19 lines
523 B
Python
"""Step definitions for plugin CLI commands."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import Any
|
|
|
|
from behave import then
|
|
|
|
|
|
@then("the plugin CLI output should be valid JSON")
|
|
def step_plugin_output_is_json(context: Any) -> None:
|
|
"""Check if plugin CLI output is valid JSON."""
|
|
output = getattr(context, "command_output", "")
|
|
try:
|
|
context.json_output = json.loads(output)
|
|
except json.JSONDecodeError as e:
|
|
raise AssertionError(f"Output is not valid JSON: {e}") from e
|