style: apply ruff format to a2a_naming_regression_steps.py
CI / lint (pull_request) Successful in 42s
CI / build (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 33s
CI / push-validation (pull_request) Successful in 36s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m10s
CI / security (pull_request) Successful in 1m21s
CI / unit_tests (pull_request) Successful in 5m19s
CI / coverage (pull_request) Failing after 1m3s
CI / docker (pull_request) Successful in 1m42s
CI / integration_tests (pull_request) Failing after 30m11s
CI / status-check (pull_request) Has been cancelled
CI / lint (pull_request) Successful in 42s
CI / build (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 33s
CI / push-validation (pull_request) Successful in 36s
CI / quality (pull_request) Successful in 1m0s
CI / typecheck (pull_request) Successful in 1m10s
CI / security (pull_request) Successful in 1m21s
CI / unit_tests (pull_request) Successful in 5m19s
CI / coverage (pull_request) Failing after 1m3s
CI / docker (pull_request) Successful in 1m42s
CI / integration_tests (pull_request) Failing after 30m11s
CI / status-check (pull_request) Has been cancelled
This commit is contained in:
@@ -12,6 +12,7 @@ def step_a2a_module_installed(context: Any) -> None:
|
||||
"""Verify the A2A module is properly installed."""
|
||||
try:
|
||||
import cleveragents.a2a # noqa: F401
|
||||
|
||||
context.a2a_module = importlib.import_module("cleveragents.a2a")
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"A2A module not installed: {e}") from e
|
||||
@@ -30,8 +31,14 @@ def step_no_acp_references(context: Any) -> None:
|
||||
if "acp" in content.lower():
|
||||
# Check if it's actually an ACP reference (not just in comments)
|
||||
for line in content.split("\n"):
|
||||
if ("acp" in line.lower() and not line.strip().startswith("#") and
|
||||
("from cleveragents.acp" in line or "import cleveragents.acp" in line)):
|
||||
if (
|
||||
"acp" in line.lower()
|
||||
and not line.strip().startswith("#")
|
||||
and (
|
||||
"from cleveragents.acp" in line
|
||||
or "import cleveragents.acp" in line
|
||||
)
|
||||
):
|
||||
acp_found = True
|
||||
break
|
||||
|
||||
@@ -44,6 +51,7 @@ def step_import_a2a_facade(context: Any) -> None:
|
||||
"""Import the A2A facade from the new module path."""
|
||||
try:
|
||||
from cleveragents.a2a import A2aLocalFacade
|
||||
|
||||
context.a2a_facade = A2aLocalFacade
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"Failed to import A2A facade: {e}") from e
|
||||
@@ -52,15 +60,20 @@ def step_import_a2a_facade(context: Any) -> None:
|
||||
@then("the import succeeds")
|
||||
def step_import_succeeds(context: Any) -> None:
|
||||
"""Verify the import succeeded."""
|
||||
assert hasattr(context, "a2a_facade") or hasattr(context, "a2a_clients") or \
|
||||
hasattr(context, "a2a_models") or hasattr(context, "a2a_errors") or \
|
||||
hasattr(context, "a2a_events"), "Import did not succeed"
|
||||
assert (
|
||||
hasattr(context, "a2a_facade")
|
||||
or hasattr(context, "a2a_clients")
|
||||
or hasattr(context, "a2a_models")
|
||||
or hasattr(context, "a2a_errors")
|
||||
or hasattr(context, "a2a_events")
|
||||
), "Import did not succeed"
|
||||
|
||||
|
||||
@then("the facade is an instance of A2aLocalFacade")
|
||||
def step_facade_is_a2a_facade(context: Any) -> None:
|
||||
"""Verify the facade is an instance of A2aLocalFacade."""
|
||||
from cleveragents.a2a import A2aLocalFacade
|
||||
|
||||
assert context.a2a_facade is A2aLocalFacade, "Facade is not A2aLocalFacade"
|
||||
|
||||
|
||||
@@ -69,6 +82,7 @@ def step_import_a2a_clients(context: Any) -> None:
|
||||
"""Import A2A clients from the new module path."""
|
||||
try:
|
||||
from cleveragents.a2a import ServerClient
|
||||
|
||||
context.a2a_clients = ServerClient
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"Failed to import A2A clients: {e}") from e
|
||||
@@ -78,8 +92,8 @@ def step_import_a2a_clients(context: Any) -> None:
|
||||
def step_clients_contains_factory(context: Any) -> None:
|
||||
"""Verify the clients module contains ServerClient."""
|
||||
from cleveragents.a2a import ServerClient
|
||||
assert ServerClient is not None, \
|
||||
"ServerClient not found in clients module"
|
||||
|
||||
assert ServerClient is not None, "ServerClient not found in clients module"
|
||||
|
||||
|
||||
@when('I import A2A models from "cleveragents.a2a"')
|
||||
@@ -87,6 +101,7 @@ def step_import_a2a_models(context: Any) -> None:
|
||||
"""Import A2A models from the new module path."""
|
||||
try:
|
||||
from cleveragents.a2a import A2aRequest
|
||||
|
||||
context.a2a_models = A2aRequest
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"Failed to import A2A models: {e}") from e
|
||||
@@ -96,8 +111,8 @@ def step_import_a2a_models(context: Any) -> None:
|
||||
def step_models_contains_message(context: Any) -> None:
|
||||
"""Verify the models module contains A2aRequest."""
|
||||
from cleveragents.a2a import A2aRequest
|
||||
assert A2aRequest is not None, \
|
||||
"A2aRequest not found in models module"
|
||||
|
||||
assert A2aRequest is not None, "A2aRequest not found in models module"
|
||||
|
||||
|
||||
@when('I import A2A errors from "cleveragents.a2a"')
|
||||
@@ -105,6 +120,7 @@ def step_import_a2a_errors(context: Any) -> None:
|
||||
"""Import A2A errors from the new module path."""
|
||||
try:
|
||||
from cleveragents.a2a import A2aError
|
||||
|
||||
context.a2a_errors = A2aError
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"Failed to import A2A errors: {e}") from e
|
||||
@@ -114,8 +130,8 @@ def step_import_a2a_errors(context: Any) -> None:
|
||||
def step_errors_contains_error(context: Any) -> None:
|
||||
"""Verify the errors module contains A2aError."""
|
||||
from cleveragents.a2a import A2aError
|
||||
assert A2aError is not None, \
|
||||
"A2aError not found in errors module"
|
||||
|
||||
assert A2aError is not None, "A2aError not found in errors module"
|
||||
|
||||
|
||||
@when('I import A2A events from "cleveragents.a2a"')
|
||||
@@ -123,6 +139,7 @@ def step_import_a2a_events(context: Any) -> None:
|
||||
"""Import A2A events from the new module path."""
|
||||
try:
|
||||
from cleveragents.a2a import A2aEventQueue
|
||||
|
||||
context.a2a_events = A2aEventQueue
|
||||
except ImportError as e:
|
||||
raise AssertionError(f"Failed to import A2A events: {e}") from e
|
||||
@@ -132,8 +149,8 @@ def step_import_a2a_events(context: Any) -> None:
|
||||
def step_events_contains_emitter(context: Any) -> None:
|
||||
"""Verify the events module contains A2aEventQueue."""
|
||||
from cleveragents.a2a import A2aEventQueue
|
||||
assert A2aEventQueue is not None, \
|
||||
"A2aEventQueue not found in events module"
|
||||
|
||||
assert A2aEventQueue is not None, "A2aEventQueue not found in events module"
|
||||
|
||||
|
||||
@when('I attempt to import from old "cleveragents.acp" path')
|
||||
@@ -156,8 +173,9 @@ def step_import_error_raised(context: Any) -> None:
|
||||
def step_error_message_correct(context: Any) -> None:
|
||||
"""Verify the error message indicates the module does not exist."""
|
||||
error_msg = str(context.import_error).lower()
|
||||
assert "no module" in error_msg or "cannot find" in error_msg or "acp" in error_msg, \
|
||||
f"Error message does not indicate missing module: {context.import_error}"
|
||||
assert (
|
||||
"no module" in error_msg or "cannot find" in error_msg or "acp" in error_msg
|
||||
), f"Error message does not indicate missing module: {context.import_error}"
|
||||
|
||||
|
||||
@when('I import from "cleveragents.a2a"')
|
||||
@@ -172,36 +190,41 @@ def step_import_from_a2a(context: Any) -> None:
|
||||
@then("the module exports A2aLocalFacade")
|
||||
def step_module_exports_facade(context: Any) -> None:
|
||||
"""Verify the module exports A2aLocalFacade."""
|
||||
assert hasattr(context.a2a_module, "A2aLocalFacade"), \
|
||||
assert hasattr(context.a2a_module, "A2aLocalFacade"), (
|
||||
"A2aLocalFacade not exported from cleveragents.a2a"
|
||||
)
|
||||
|
||||
|
||||
@then("the module exports ServerClient")
|
||||
def step_module_exports_factory(context: Any) -> None:
|
||||
"""Verify the module exports ServerClient."""
|
||||
assert hasattr(context.a2a_module, "ServerClient"), \
|
||||
assert hasattr(context.a2a_module, "ServerClient"), (
|
||||
"ServerClient not exported from cleveragents.a2a"
|
||||
)
|
||||
|
||||
|
||||
@then("the module exports A2aRequest")
|
||||
def step_module_exports_message(context: Any) -> None:
|
||||
"""Verify the module exports A2aRequest."""
|
||||
assert hasattr(context.a2a_module, "A2aRequest"), \
|
||||
assert hasattr(context.a2a_module, "A2aRequest"), (
|
||||
"A2aRequest not exported from cleveragents.a2a"
|
||||
)
|
||||
|
||||
|
||||
@then("the module exports A2aError")
|
||||
def step_module_exports_error(context: Any) -> None:
|
||||
"""Verify the module exports A2aError."""
|
||||
assert hasattr(context.a2a_module, "A2aError"), \
|
||||
assert hasattr(context.a2a_module, "A2aError"), (
|
||||
"A2aError not exported from cleveragents.a2a"
|
||||
)
|
||||
|
||||
|
||||
@then("the module exports A2aEventQueue")
|
||||
def step_module_exports_emitter(context: Any) -> None:
|
||||
"""Verify the module exports A2aEventQueue."""
|
||||
assert hasattr(context.a2a_module, "A2aEventQueue"), \
|
||||
assert hasattr(context.a2a_module, "A2aEventQueue"), (
|
||||
"A2aEventQueue not exported from cleveragents.a2a"
|
||||
)
|
||||
|
||||
|
||||
@when("I scan the source code for ACP references")
|
||||
@@ -220,7 +243,9 @@ def step_scan_acp_references(context: Any) -> None:
|
||||
if "from cleveragents.acp" in line:
|
||||
context.acp_from_imports.append((py_file, line_num, line.strip()))
|
||||
if "import cleveragents.acp" in line:
|
||||
context.acp_import_statements.append((py_file, line_num, line.strip()))
|
||||
context.acp_import_statements.append(
|
||||
(py_file, line_num, line.strip())
|
||||
)
|
||||
if " acp " in line.lower() and "a2a" not in line.lower():
|
||||
context.acp_imports.append((py_file, line_num, line.strip()))
|
||||
|
||||
@@ -228,22 +253,23 @@ def step_scan_acp_references(context: Any) -> None:
|
||||
@then('no "acp" imports are found')
|
||||
def step_no_acp_imports(context: Any) -> None:
|
||||
"""Verify no ACP imports are found."""
|
||||
assert len(context.acp_imports) == 0, \
|
||||
f"ACP imports found: {context.acp_imports}"
|
||||
assert len(context.acp_imports) == 0, f"ACP imports found: {context.acp_imports}"
|
||||
|
||||
|
||||
@then('no "from cleveragents.acp" statements are found')
|
||||
def step_no_from_acp_statements(context: Any) -> None:
|
||||
"""Verify no 'from cleveragents.acp' statements are found."""
|
||||
assert len(context.acp_from_imports) == 0, \
|
||||
assert len(context.acp_from_imports) == 0, (
|
||||
f"'from cleveragents.acp' statements found: {context.acp_from_imports}"
|
||||
)
|
||||
|
||||
|
||||
@then('no "import cleveragents.acp" statements are found')
|
||||
def step_no_import_acp_statements(context: Any) -> None:
|
||||
"""Verify no 'import cleveragents.acp' statements are found."""
|
||||
assert len(context.acp_import_statements) == 0, \
|
||||
assert len(context.acp_import_statements) == 0, (
|
||||
f"'import cleveragents.acp' statements found: {context.acp_import_statements}"
|
||||
)
|
||||
|
||||
|
||||
@when("I inspect the A2A module structure")
|
||||
@@ -324,6 +350,7 @@ def step_initialize_a2a_facade(context: Any) -> None:
|
||||
"""Initialize the A2A facade."""
|
||||
try:
|
||||
from cleveragents.a2a import A2aLocalFacade
|
||||
|
||||
context.facade_instance = A2aLocalFacade()
|
||||
except Exception as e:
|
||||
context.facade_init_error = e
|
||||
@@ -332,8 +359,9 @@ def step_initialize_a2a_facade(context: Any) -> None:
|
||||
@then("the facade initializes without errors")
|
||||
def step_facade_initializes(context: Any) -> None:
|
||||
"""Verify the facade initializes without errors."""
|
||||
assert not hasattr(context, "facade_init_error"), \
|
||||
assert not hasattr(context, "facade_init_error"), (
|
||||
f"Facade initialization failed: {getattr(context, 'facade_init_error', None)}"
|
||||
)
|
||||
assert hasattr(context, "facade_instance"), "Facade instance not created"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user