Files
cleveragents-core/robot/tool_lifecycle.robot
freemo b122ec7ed5
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 55s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 26s
CI / e2e_tests (pull_request) Successful in 3m38s
CI / integration_tests (pull_request) Successful in 6m42s
CI / unit_tests (pull_request) Successful in 8m19s
CI / docker (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 15m23s
CI / status-check (pull_request) Successful in 2s
fix(test-infra): remove redundant ${PYTHON} variable definitions from robot files
Remove the local ${PYTHON}    python (and python3) variable definitions from
the *** Variables *** sections of all affected robot files. These local
definitions were overriding the pabot-injected venv Python path passed via
--variable PYTHON:/path/to/venv/python, causing tests to use the system
Python (which lacks required packages like structlog, sqlalchemy, etc.)
instead of the nox venv Python.

The correct ${PYTHON} value is already set by Setup Test Environment in
common.resource via sys.executable, and pabot passes it via --variable.
The local fallback definitions are redundant and harmful in parallel runs.

Audit found 56 robot files with the pattern (more than the 9 originally
identified in the issue). All occurrences have been removed.

ISSUES CLOSED: #1309
2026-04-14 14:50:55 +00:00

55 lines
3.6 KiB
Plaintext

*** Settings ***
Documentation Tool lifecycle runtime smoke tests
Library Process
Library OperatingSystem
*** Test Cases ***
Tool Package Is Importable
[Documentation] Verify the tool lifecycle package can be imported
${result}= Run Process ${PYTHON} -c
... from cleveragents.tool import ToolRuntime, ToolExecutionContext, ToolResult, ToolDescriptor, ToolLifecycleCache, CancellationToken, Change, ChangeOperation, BoundResource; print('OK')
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} OK
Tool Context Creation Works
[Documentation] Verify ToolExecutionContext can be created
${code}= Set Variable from cleveragents.tool import ToolExecutionContext; ctx = ToolExecutionContext(plan_id='test-plan'); print(f'plan={ctx.plan_id} changes={len(ctx.changes)} traces={len(ctx.traces)}')
${result}= Run Process ${PYTHON} -c ${code}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} plan=test-plan
Should Contain ${result.stdout} changes=0
Should Contain ${result.stdout} traces=0
Cancellation Token Works
[Documentation] Verify CancellationToken cancel and check
${code}= Set Variable from cleveragents.tool import CancellationToken; t = CancellationToken(); print(f'before={t.is_cancelled}'); t.cancel(); print(f'after={t.is_cancelled}')
${result}= Run Process ${PYTHON} -c ${code}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} before=False
Should Contain ${result.stdout} after=True
Schema Validator Works
[Documentation] Verify JSON Schema validation
${code}= Set Variable from cleveragents.tool import validate_tool_input, ToolSchemaValidationError; schema = {"type": "object", "properties": {"x": {"type": "string"}}, "required": ["x"]}; validate_tool_input({"x": "hi"}, schema); print('valid'); ok = False\ntry:\n validate_tool_input({"x": 1}, schema)\nexcept ToolSchemaValidationError:\n ok = True\nprint(f'invalid_caught={ok}')
${result}= Run Process ${PYTHON} -c ${code}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} valid
Should Contain ${result.stdout} invalid_caught=True
Tool Runtime Registration Works
[Documentation] Verify ToolRuntime register and list
${code}= Set Variable from cleveragents.tool import ToolRuntime; from cleveragents.domain.models.core.tool import Tool, ToolSource, ToolCapability; rt = ToolRuntime(); t = Tool(name='test/read', description='Read', source=ToolSource.BUILTIN, capability=ToolCapability(read_only=True)); print(f'before={rt.list_tools()}'); rt.register_tool(t, None); print(f'after={rt.list_tools()}')
${result}= Run Process ${PYTHON} -c ${code}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} before=[]
Should Contain ${result.stdout} test/read
Lifecycle Cache Works
[Documentation] Verify ToolLifecycleCache put/get
${code}= Set Variable from cleveragents.tool import ToolLifecycleCache; c = ToolLifecycleCache(); print(f'plans={c.plan_count}'); c.put('p1', 'tool/a', 'dummy'); print(f'plans_after={c.plan_count}'); r = c.get('p1', 'tool/a'); print(f'got={r}')
${result}= Run Process ${PYTHON} -c ${code}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} plans=0
Should Contain ${result.stdout} plans_after=1
Should Contain ${result.stdout} got=dummy