test(a2a): fix regression test expectations to match actual module exports

This commit is contained in:
2026-04-22 06:59:42 +00:00
committed by Forgejo
parent 81157826bf
commit eab8466489
2 changed files with 66 additions and 62 deletions
+10 -10
View File
@@ -9,27 +9,27 @@ Feature: A2A Module Naming Regression Tests
Scenario: Import A2A facade from new module path
When I import the A2A facade from "cleveragents.a2a"
Then the import succeeds
And the facade is an instance of A2AFacade
And the facade is an instance of A2aLocalFacade
Scenario: Import A2A clients from new module path
When I import A2A clients from "cleveragents.a2a"
Then the import succeeds
And the clients module contains ClientFactory
And the clients module contains ServerClient
Scenario: Import A2A models from new module path
When I import A2A models from "cleveragents.a2a"
Then the import succeeds
And the models module contains A2AMessage
And the models module contains A2aRequest
Scenario: Import A2A errors from new module path
When I import A2A errors from "cleveragents.a2a"
Then the import succeeds
And the errors module contains A2AError
And the errors module contains A2aError
Scenario: Import A2A events from new module path
When I import A2A events from "cleveragents.a2a"
Then the import succeeds
And the events module contains EventEmitter
And the events module contains A2aEventQueue
Scenario: Old ACP import path raises ImportError
When I attempt to import from old "cleveragents.acp" path
@@ -38,11 +38,11 @@ Feature: A2A Module Naming Regression Tests
Scenario: A2A __init__ exports all public symbols
When I import from "cleveragents.a2a"
Then the module exports A2AFacade
And the module exports ClientFactory
And the module exports A2AMessage
And the module exports A2AError
And the module exports EventEmitter
Then the module exports A2aLocalFacade
And the module exports ServerClient
And the module exports A2aRequest
And the module exports A2aError
And the module exports A2aEventQueue
Scenario: No ACP references in source code
When I scan the source code for ACP references
+56 -52
View File
@@ -43,8 +43,8 @@ def step_no_acp_references(context: Any) -> None:
def step_import_a2a_facade(context: Any) -> None:
"""Import the A2A facade from the new module path."""
try:
from cleveragents.a2a import A2AFacade
context.a2a_facade = A2AFacade
from cleveragents.a2a import A2aLocalFacade
context.a2a_facade = A2aLocalFacade
except ImportError as e:
raise AssertionError(f"Failed to import A2A facade: {e}") from e
@@ -57,79 +57,83 @@ def step_import_succeeds(context: Any) -> None:
hasattr(context, "a2a_events"), "Import did not succeed"
@then("the facade is an instance of A2AFacade")
@then("the facade is an instance of A2aLocalFacade")
def step_facade_is_a2a_facade(context: Any) -> None:
"""Verify the facade is an instance of A2AFacade."""
from cleveragents.a2a import A2AFacade
assert context.a2a_facade is A2AFacade, "Facade is not A2AFacade"
"""Verify the facade is an instance of A2aLocalFacade."""
from cleveragents.a2a import A2aLocalFacade
assert context.a2a_facade is A2aLocalFacade, "Facade is not A2aLocalFacade"
@when('I import A2A clients from "cleveragents.a2a"')
def step_import_a2a_clients(context: Any) -> None:
"""Import A2A clients from the new module path."""
try:
from cleveragents.a2a import clients
context.a2a_clients = clients
from cleveragents.a2a import ServerClient
context.a2a_clients = ServerClient
except ImportError as e:
raise AssertionError(f"Failed to import A2A clients: {e}") from e
@then("the clients module contains ClientFactory")
@then("the clients module contains ServerClient")
def step_clients_contains_factory(context: Any) -> None:
"""Verify the clients module contains ClientFactory."""
assert hasattr(context.a2a_clients, "ClientFactory"), \
"ClientFactory not found in clients module"
"""Verify the clients module contains ServerClient."""
from cleveragents.a2a import ServerClient
assert ServerClient is not None, \
"ServerClient not found in clients module"
@when('I import A2A models from "cleveragents.a2a"')
def step_import_a2a_models(context: Any) -> None:
"""Import A2A models from the new module path."""
try:
from cleveragents.a2a import models
context.a2a_models = models
from cleveragents.a2a import A2aRequest
context.a2a_models = A2aRequest
except ImportError as e:
raise AssertionError(f"Failed to import A2A models: {e}") from e
@then("the models module contains A2AMessage")
@then("the models module contains A2aRequest")
def step_models_contains_message(context: Any) -> None:
"""Verify the models module contains A2AMessage."""
assert hasattr(context.a2a_models, "A2AMessage"), \
"A2AMessage not found in models module"
"""Verify the models module contains A2aRequest."""
from cleveragents.a2a import A2aRequest
assert A2aRequest is not None, \
"A2aRequest not found in models module"
@when('I import A2A errors from "cleveragents.a2a"')
def step_import_a2a_errors(context: Any) -> None:
"""Import A2A errors from the new module path."""
try:
from cleveragents.a2a import errors
context.a2a_errors = errors
from cleveragents.a2a import A2aError
context.a2a_errors = A2aError
except ImportError as e:
raise AssertionError(f"Failed to import A2A errors: {e}") from e
@then("the errors module contains A2AError")
@then("the errors module contains A2aError")
def step_errors_contains_error(context: Any) -> None:
"""Verify the errors module contains A2AError."""
assert hasattr(context.a2a_errors, "A2AError"), \
"A2AError not found in errors module"
"""Verify the errors module contains A2aError."""
from cleveragents.a2a import A2aError
assert A2aError is not None, \
"A2aError not found in errors module"
@when('I import A2A events from "cleveragents.a2a"')
def step_import_a2a_events(context: Any) -> None:
"""Import A2A events from the new module path."""
try:
from cleveragents.a2a import events
context.a2a_events = events
from cleveragents.a2a import A2aEventQueue
context.a2a_events = A2aEventQueue
except ImportError as e:
raise AssertionError(f"Failed to import A2A events: {e}") from e
@then("the events module contains EventEmitter")
@then("the events module contains A2aEventQueue")
def step_events_contains_emitter(context: Any) -> None:
"""Verify the events module contains EventEmitter."""
assert hasattr(context.a2a_events, "EventEmitter"), \
"EventEmitter not found in events module"
"""Verify the events module contains A2aEventQueue."""
from cleveragents.a2a import A2aEventQueue
assert A2aEventQueue is not None, \
"A2aEventQueue not found in events module"
@when('I attempt to import from old "cleveragents.acp" path')
@@ -165,39 +169,39 @@ def step_import_from_a2a(context: Any) -> None:
raise AssertionError(f"Failed to import from cleveragents.a2a: {e}") from e
@then("the module exports A2AFacade")
@then("the module exports A2aLocalFacade")
def step_module_exports_facade(context: Any) -> None:
"""Verify the module exports A2AFacade."""
assert hasattr(context.a2a_module, "A2AFacade"), \
"A2AFacade not exported from cleveragents.a2a"
"""Verify the module exports A2aLocalFacade."""
assert hasattr(context.a2a_module, "A2aLocalFacade"), \
"A2aLocalFacade not exported from cleveragents.a2a"
@then("the module exports ClientFactory")
@then("the module exports ServerClient")
def step_module_exports_factory(context: Any) -> None:
"""Verify the module exports ClientFactory."""
assert hasattr(context.a2a_module, "ClientFactory"), \
"ClientFactory not exported from cleveragents.a2a"
"""Verify the module exports ServerClient."""
assert hasattr(context.a2a_module, "ServerClient"), \
"ServerClient not exported from cleveragents.a2a"
@then("the module exports A2AMessage")
@then("the module exports A2aRequest")
def step_module_exports_message(context: Any) -> None:
"""Verify the module exports A2AMessage."""
assert hasattr(context.a2a_module, "A2AMessage"), \
"A2AMessage not exported from cleveragents.a2a"
"""Verify the module exports A2aRequest."""
assert hasattr(context.a2a_module, "A2aRequest"), \
"A2aRequest not exported from cleveragents.a2a"
@then("the module exports A2AError")
@then("the module exports A2aError")
def step_module_exports_error(context: Any) -> None:
"""Verify the module exports A2AError."""
assert hasattr(context.a2a_module, "A2AError"), \
"A2AError not exported from cleveragents.a2a"
"""Verify the module exports A2aError."""
assert hasattr(context.a2a_module, "A2aError"), \
"A2aError not exported from cleveragents.a2a"
@then("the module exports EventEmitter")
@then("the module exports A2aEventQueue")
def step_module_exports_emitter(context: Any) -> None:
"""Verify the module exports EventEmitter."""
assert hasattr(context.a2a_module, "EventEmitter"), \
"EventEmitter not exported from cleveragents.a2a"
"""Verify the module exports A2aEventQueue."""
assert hasattr(context.a2a_module, "A2aEventQueue"), \
"A2aEventQueue not exported from cleveragents.a2a"
@when("I scan the source code for ACP references")
@@ -319,8 +323,8 @@ def step_module_contains_cli_bootstrap(context: Any) -> None:
def step_initialize_a2a_facade(context: Any) -> None:
"""Initialize the A2A facade."""
try:
from cleveragents.a2a import A2AFacade
context.facade_instance = A2AFacade()
from cleveragents.a2a import A2aLocalFacade
context.facade_instance = A2aLocalFacade()
except Exception as e:
context.facade_init_error = e