fix(plugins): clean up unused imports in plugin_executing_state_steps.py

Remove unused imports (Any, given, PluginManager, PluginDescriptor) and
fix import ordering to satisfy ruff linting rules.
This commit is contained in:
2026-04-19 00:55:52 +00:00
committed by Forgejo
parent b0edcb53a4
commit 4139addbf5
+2 -11
View File
@@ -9,22 +9,16 @@ Based on issue #5691.
from __future__ import annotations
from typing import Any
from unittest.mock import patch
from behave import given, then, when # type: ignore[import-untyped]
from behave import then, when # type: ignore[import-untyped]
from behave.runner import Context # type: ignore[import-untyped]
from cleveragents.infrastructure.plugins.exceptions import (
PluginError,
PluginNotFoundError,
)
from cleveragents.infrastructure.plugins.manager import PluginManager
from cleveragents.infrastructure.plugins.types import (
PluginDescriptor,
PluginState,
)
from cleveragents.infrastructure.plugins.types import PluginState
# ---------------------------------------------------------------------------
# Execute plugin — happy path
@@ -64,7 +58,6 @@ def step_execution_result_empty_list(context: Context) -> None:
def step_attempt_execute_failing(context: Context, name: str) -> None:
"""Execute a method that raises an exception on the plugin."""
context.caught_exception = None
# Patch the instance's search method to raise a RuntimeError
instance = context.manager.get_plugin_instance(name)
if instance is not None:
with patch.object(instance, "search", side_effect=RuntimeError("boom")):
@@ -79,7 +72,6 @@ def step_attempt_execute_failing(context: Context, name: str) -> None:
except PluginError as exc:
context.caught_exception = exc
else:
# Plugin not activated — try to execute anyway to get the error
try:
context.manager.execute_plugin(name, "search", "test", scope=frozenset())
except PluginError as exc:
@@ -123,7 +115,6 @@ def step_attempt_execute_unknown(context: Context, name: str) -> None:
context.caught_exception = exc
# ---------------------------------------------------------------------------
# Thread safety: EXECUTING state prevents deactivation
# ---------------------------------------------------------------------------