Tests: fixed some minor bugs in our tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Step definitions for AutoDebug integration tests."""
|
||||
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from behave import given, then, when
|
||||
from behave.runner import Context
|
||||
@@ -105,8 +105,20 @@ def step_run_auto_debug_build(context: Context, max_attempts: int) -> None:
|
||||
# Subsequent attempts succeed if AutoDebug can fix
|
||||
return original_build(project, progress_callback=progress_callback)
|
||||
|
||||
# Patch build_plan
|
||||
with patch.object(plan_service, "build_plan", side_effect=mock_build):
|
||||
# Create mock LLM that returns deterministic responses
|
||||
mock_llm = MagicMock()
|
||||
mock_response = Mock()
|
||||
mock_response.content = "Mock LLM response"
|
||||
mock_llm.invoke = MagicMock(return_value=mock_response)
|
||||
|
||||
# Patch build_plan and the LLM creation
|
||||
with (
|
||||
patch.object(plan_service, "build_plan", side_effect=mock_build),
|
||||
patch(
|
||||
"cleveragents.application.agents.base_agent.BaseAgent._create_llm",
|
||||
return_value=mock_llm,
|
||||
),
|
||||
):
|
||||
try:
|
||||
success, changes, error = plan_service.auto_debug_build(
|
||||
project=context.project, max_attempts=max_attempts
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Step definitions for CLI coverage tests."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
from behave import then, when
|
||||
@@ -17,11 +18,16 @@ def step_run_shell_command(context, command):
|
||||
# Check if we have a test directory to run from
|
||||
cwd = context.test_dir if hasattr(context, "test_dir") else None
|
||||
|
||||
# Replace 'cleveragents' with 'python -m cleveragents' to run as module
|
||||
if command.startswith("cleveragents "):
|
||||
command = command.replace(
|
||||
"cleveragents ", "python -m cleveragents.cli.main ", 1
|
||||
)
|
||||
# Replace 'cleveragents' with the current Python interpreter running the module
|
||||
# This ensures we use the same Python (from nox venv) that has all dependencies
|
||||
if command.startswith("cleveragents"):
|
||||
# Handle both "cleveragents --arg" and "cleveragents command --arg"
|
||||
# Use cleveragents.cli.main since cleveragents.cli is a package without __main__.py
|
||||
python_cmd = f'"{sys.executable}" -m cleveragents.cli.main'
|
||||
if command == "cleveragents":
|
||||
command = python_cmd
|
||||
else:
|
||||
command = python_cmd + command[len("cleveragents") :]
|
||||
|
||||
# Use shell=True to handle quoted arguments correctly
|
||||
result = subprocess.run(
|
||||
|
||||
+11
-9
@@ -6,13 +6,15 @@ Library String
|
||||
Library Collections
|
||||
|
||||
*** Variables ***
|
||||
# Empty variables section - we'll use command arguments directly
|
||||
# PYTHON variable is passed from nox via --variable PYTHON:/path/to/python
|
||||
# Default to 'python' if not passed (for standalone runs)
|
||||
${PYTHON} python
|
||||
|
||||
*** Test Cases ***
|
||||
CLI Help Command Performance
|
||||
[Documentation] Benchmark help command execution time
|
||||
${start_time}= Get Time epoch
|
||||
${result}= Run Process python -m cleveragents --help
|
||||
${result}= Run Process ${PYTHON} -m cleveragents --help
|
||||
${end_time}= Get Time epoch
|
||||
${duration}= Evaluate ${end_time} - ${start_time}
|
||||
Should Be True ${duration} < 2 Help command took too long: ${duration}s
|
||||
@@ -23,7 +25,7 @@ CLI Help Command Performance
|
||||
CLI Version Command Performance
|
||||
[Documentation] Benchmark version command execution time
|
||||
${start_time}= Get Time epoch
|
||||
${result}= Run Process python -m cleveragents --version
|
||||
${result}= Run Process ${PYTHON} -m cleveragents --version
|
||||
${end_time}= Get Time epoch
|
||||
${duration}= Evaluate ${end_time} - ${start_time}
|
||||
Should Be True ${duration} < 2 Version command took too long: ${duration}s
|
||||
@@ -32,14 +34,14 @@ CLI Version Command Performance
|
||||
|
||||
Python Module Entry Works
|
||||
[Documentation] Verify Python module entry point works correctly
|
||||
${result}= Run Process python -m cleveragents --help
|
||||
${result}= Run Process ${PYTHON} -m cleveragents --help
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} AI-powered development assistant
|
||||
Should Contain ${result.stdout} Usage:
|
||||
|
||||
CLI Diagnostics Command
|
||||
[Documentation] Test diagnostics command functionality
|
||||
${result}= Run Process python -m cleveragents diagnostics
|
||||
${result}= Run Process ${PYTHON} -m cleveragents diagnostics
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} CleverAgents Diagnostics
|
||||
Should Contain ${result.stdout} Version:
|
||||
@@ -48,14 +50,14 @@ CLI Diagnostics Command
|
||||
|
||||
CLI Info Command
|
||||
[Documentation] Test info command functionality
|
||||
${result}= Run Process python -m cleveragents info
|
||||
${result}= Run Process ${PYTHON} -m cleveragents info
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} CleverAgents Information
|
||||
Should Contain ${result.stdout} Version:
|
||||
|
||||
Invalid Command Error Handling
|
||||
[Documentation] Verify proper error handling for invalid commands
|
||||
${result}= Run Process python -m cleveragents invalid-command-xyz
|
||||
${result}= Run Process ${PYTHON} -m cleveragents invalid-command-xyz
|
||||
Should Not Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stderr} Error: Invalid command
|
||||
|
||||
@@ -64,7 +66,7 @@ Multiple Commands Benchmark
|
||||
${commands}= Create List --help --version diagnostics info
|
||||
${total_start}= Get Time epoch
|
||||
FOR ${cmd} IN @{commands}
|
||||
${result}= Run Process python -m cleveragents ${cmd}
|
||||
${result}= Run Process ${PYTHON} -m cleveragents ${cmd}
|
||||
Should Be Equal As Integers ${result.rc} 0 Command failed: ${cmd}
|
||||
END
|
||||
${total_end}= Get Time epoch
|
||||
@@ -76,7 +78,7 @@ CLI Response Time Consistency
|
||||
@{durations}= Create List
|
||||
FOR ${i} IN RANGE 5
|
||||
${start}= Get Time epoch
|
||||
${result}= Run Process python -m cleveragents --help
|
||||
${result}= Run Process ${PYTHON} -m cleveragents --help
|
||||
${end}= Get Time epoch
|
||||
${duration}= Evaluate ${end} - ${start}
|
||||
Append To List ${durations} ${duration}
|
||||
|
||||
@@ -7,6 +7,7 @@ Library Process
|
||||
Library String
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${TEST_DIR} ${TEMPDIR}${/}cleveragents_plan_context_test_${SUITE NAME}
|
||||
${PROJECT_NAME} test-project
|
||||
|
||||
@@ -15,7 +16,7 @@ Initialize New Project
|
||||
[Documentation] Test cleveragents init command
|
||||
[Setup] Setup Test Directory
|
||||
|
||||
${result}= Run Process python -m cleveragents init ${PROJECT_NAME}
|
||||
${result}= Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME}
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -33,13 +34,13 @@ Add Files To Context
|
||||
Create File ${TEST_DIR}${/}main.py def main(): pass
|
||||
|
||||
# Add files to context
|
||||
${result}= Run Process python -m cleveragents context-load test.py main.py
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context-load test.py main.py
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify files are in context
|
||||
${result}= Run Process python -m cleveragents context list
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context list
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Contain ${result.stdout} test.py
|
||||
@@ -51,13 +52,13 @@ Create Plan With Tell
|
||||
[Documentation] Test tell command
|
||||
[Setup] Initialize Test Project
|
||||
|
||||
${result}= Run Process python -m cleveragents tell Add error handling
|
||||
${result}= Run Process ${PYTHON} -m cleveragents tell Add error handling
|
||||
... cwd=${TEST_DIR} timeout=10s
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify plan was created with correct name derived from prompt
|
||||
${result}= Run Process python -m cleveragents plan current
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan current
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Contain ${result.stdout} add_error_handling
|
||||
@@ -68,7 +69,7 @@ Build Plan
|
||||
[Documentation] Test build command
|
||||
[Setup] Initialize Test Project With Plan
|
||||
|
||||
${result}= Run Process python -m cleveragents build
|
||||
${result}= Run Process ${PYTHON} -m cleveragents build
|
||||
... cwd=${TEST_DIR} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -79,7 +80,7 @@ Apply Plan Changes
|
||||
[Documentation] Test apply command
|
||||
[Setup] Initialize Test Project With Built Plan
|
||||
|
||||
${result}= Run Process python -m cleveragents apply --yes
|
||||
${result}= Run Process ${PYTHON} -m cleveragents apply --yes
|
||||
... cwd=${TEST_DIR} timeout=10s
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -90,13 +91,13 @@ Create New Empty Plan
|
||||
[Documentation] Test plan new command
|
||||
[Setup] Initialize Test Project
|
||||
|
||||
${result}= Run Process python -m cleveragents plan new feature-plan
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan new feature-plan
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify new plan is current
|
||||
${result}= Run Process python -m cleveragents plan current
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan current
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Contain ${result.stdout} feature-plan
|
||||
@@ -107,7 +108,7 @@ Show Current Plan
|
||||
[Documentation] Test plan current command
|
||||
[Setup] Initialize Test Project
|
||||
|
||||
${result}= Run Process python -m cleveragents plan current
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan current
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -119,7 +120,7 @@ List All Plans
|
||||
[Documentation] Test plan list command
|
||||
[Setup] Initialize Test Project With Multiple Plans
|
||||
|
||||
${result}= Run Process python -m cleveragents plan list
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan list
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -134,13 +135,13 @@ Switch Between Plans
|
||||
[Setup] Initialize Test Project With Multiple Plans
|
||||
|
||||
# Switch to feature-1
|
||||
${result}= Run Process python -m cleveragents plan cd feature-1
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan cd feature-1
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify switch
|
||||
${result}= Run Process python -m cleveragents plan current
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan current
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Contain ${result.stdout} feature-1
|
||||
@@ -151,7 +152,7 @@ Continue Working On Plan
|
||||
[Documentation] Test plan continue command
|
||||
[Setup] Initialize Test Project With Plan
|
||||
|
||||
${result}= Run Process python -m cleveragents plan continue Also add logging
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan continue Also add logging
|
||||
... cwd=${TEST_DIR} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -162,7 +163,7 @@ List Context Files
|
||||
[Documentation] Test context list command
|
||||
[Setup] Initialize Test Project With Context
|
||||
|
||||
${result}= Run Process python -m cleveragents context list
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context list
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -176,14 +177,14 @@ Show Context Content
|
||||
[Setup] Initialize Test Project With Context
|
||||
|
||||
# Show specific file content
|
||||
${result}= Run Process python -m cleveragents context show test.py
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context show test.py
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} def hello
|
||||
|
||||
# Also test showing summary (without file argument)
|
||||
${result}= Run Process python -m cleveragents context show
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context show
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -197,13 +198,13 @@ Remove File From Context
|
||||
[Setup] Initialize Test Project With Context
|
||||
|
||||
# Remove test.py
|
||||
${result}= Run Process python -m cleveragents context rm test.py
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context rm test.py
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify removal
|
||||
${result}= Run Process python -m cleveragents context list
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context list
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Not Contain ${result.stdout} test.py
|
||||
@@ -215,13 +216,13 @@ Clear All Context
|
||||
[Documentation] Test context clear command
|
||||
[Setup] Initialize Test Project With Context
|
||||
|
||||
${result}= Run Process python -m cleveragents context clear --yes
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context clear --yes
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
# Verify context is empty
|
||||
${result}= Run Process python -m cleveragents context list
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context list
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Not Contain ${result.stdout} test.py
|
||||
@@ -234,7 +235,7 @@ Command Error Handling
|
||||
[Setup] Setup Test Directory
|
||||
|
||||
# Try to use command without project
|
||||
${result}= Run Process python -m cleveragents plan tell test
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan tell test
|
||||
... cwd=${TEST_DIR}
|
||||
|
||||
Should Not Be Equal As Integers ${result.rc} 0
|
||||
@@ -258,31 +259,31 @@ Cleanup Test Directory
|
||||
Initialize Test Project
|
||||
[Documentation] Initialize a test project
|
||||
Setup Test Directory
|
||||
${result}= Run Process python -m cleveragents init ${PROJECT_NAME}
|
||||
${result}= Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME}
|
||||
... cwd=${TEST_DIR}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Initialize Test Project With Plan
|
||||
[Documentation] Initialize project and create a plan
|
||||
Initialize Test Project
|
||||
${result}= Run Process python -m cleveragents tell Test instruction
|
||||
${result}= Run Process ${PYTHON} -m cleveragents tell Test instruction
|
||||
... cwd=${TEST_DIR} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Initialize Test Project With Built Plan
|
||||
[Documentation] Initialize project with a built plan
|
||||
Initialize Test Project With Plan
|
||||
${result}= Run Process python -m cleveragents build
|
||||
${result}= Run Process ${PYTHON} -m cleveragents build
|
||||
... cwd=${TEST_DIR} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Initialize Test Project With Multiple Plans
|
||||
[Documentation] Initialize project with multiple plans
|
||||
Initialize Test Project
|
||||
${result}= Run Process python -m cleveragents plan new feature-1
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan new feature-1
|
||||
... cwd=${TEST_DIR}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${result}= Run Process python -m cleveragents plan new feature-2
|
||||
${result}= Run Process ${PYTHON} -m cleveragents plan new feature-2
|
||||
... cwd=${TEST_DIR}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -291,6 +292,6 @@ Initialize Test Project With Context
|
||||
Initialize Test Project
|
||||
Create File ${TEST_DIR}${/}test.py def hello(): pass
|
||||
Create File ${TEST_DIR}${/}utils.py import os
|
||||
${result}= Run Process python -m cleveragents context-load test.py utils.py
|
||||
${result}= Run Process ${PYTHON} -m cleveragents context-load test.py utils.py
|
||||
... cwd=${TEST_DIR}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -3,10 +3,14 @@ Documentation Common resources and keywords for Robot Framework tests
|
||||
Library OperatingSystem
|
||||
Library String
|
||||
Library Collections
|
||||
Library Process
|
||||
|
||||
*** Variables ***
|
||||
${WORKSPACE} ${CURDIR}/..
|
||||
${SRC_DIR} ${WORKSPACE}/src/cleveragents
|
||||
# Use the Python interpreter that's running Robot (from nox venv)
|
||||
# This ensures we use the same Python with all dependencies installed
|
||||
${PYTHON} python
|
||||
|
||||
*** Keywords ***
|
||||
Setup Test Environment
|
||||
|
||||
@@ -6,6 +6,7 @@ Library Collections
|
||||
Library String
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${SRC_DIR} ${CURDIR}/../src
|
||||
${HELPER} ${CURDIR}/helper_context_analysis.py
|
||||
|
||||
@@ -13,7 +14,7 @@ ${HELPER} ${CURDIR}/helper_context_analysis.py
|
||||
|
||||
Context Analysis Agent Module Can Be Imported
|
||||
[Documentation] Verify the context analysis module can be imported
|
||||
${result}= Run Process python3 -c
|
||||
${result}= Run Process ${PYTHON} -c
|
||||
... import sys; sys.path.insert(0, '${SRC_DIR}'); from cleveragents.agents.context_analysis import ContextAnalysisAgent; print('SUCCESS')
|
||||
... shell=True
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -31,7 +32,7 @@ Context Analysis Agent Can Be Instantiated With Default Parameters
|
||||
... assert agent.chunk_overlap == 200
|
||||
... assert agent.llm is not None
|
||||
... print('Agent initialized successfully')
|
||||
${result}= Run Process python3 -c ${script}
|
||||
${result}= Run Process ${PYTHON} -c ${script}
|
||||
Should Contain ${result.stdout} initialized successfully
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -45,14 +46,14 @@ Context Analysis Agent Can Be Instantiated With Custom Chunk Settings
|
||||
... assert agent.chunk_size == 1000
|
||||
... assert agent.chunk_overlap == 100
|
||||
... print('Chunk size: ' + str(agent.chunk_size) + ', overlap: ' + str(agent.chunk_overlap))
|
||||
${result}= Run Process python3 -c ${script}
|
||||
${result}= Run Process ${PYTHON} -c ${script}
|
||||
Should Contain ${result.stdout} Chunk size: 1000
|
||||
Should Contain ${result.stdout} overlap: 100
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Context Analysis Agent Workflow Contains Expected Nodes
|
||||
[Documentation] Verify all workflow nodes are present using helper script
|
||||
${result}= Run Process python3 ${HELPER} nodes
|
||||
${result}= Run Process ${PYTHON} ${HELPER} nodes
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -69,13 +70,13 @@ LangGraph Graphs Package Exports Context Analysis Agent
|
||||
... assert 'ContextAnalysisAgent' in __all__
|
||||
... assert ContextAnalysisAgent is ExportedContextAgent
|
||||
... print('ContextAnalysisAgent export verified')
|
||||
${result}= Run Process python3 -c ${script}
|
||||
${result}= Run Process ${PYTHON} -c ${script}
|
||||
Should Contain ${result.stdout} ContextAnalysisAgent export verified
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Context Analysis Agent Can Load Files
|
||||
[Documentation] Test file loading functionality using helper script
|
||||
${result}= Run Process python3 ${HELPER} load_files
|
||||
${result}= Run Process ${PYTHON} ${HELPER} load_files
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -84,7 +85,7 @@ Context Analysis Agent Can Load Files
|
||||
|
||||
Context Analysis Agent Handles Missing Files
|
||||
[Documentation] Test error handling for missing files using helper script
|
||||
${result}= Run Process python3 ${HELPER} missing_file
|
||||
${result}= Run Process ${PYTHON} ${HELPER} missing_file
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -93,7 +94,7 @@ Context Analysis Agent Handles Missing Files
|
||||
|
||||
Context Analysis Agent Invoke Returns Complete Result
|
||||
[Documentation] Test complete workflow execution via invoke using helper script
|
||||
${result}= Run Process python3 ${HELPER} invoke
|
||||
${result}= Run Process ${PYTHON} ${HELPER} invoke
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -102,7 +103,7 @@ Context Analysis Agent Invoke Returns Complete Result
|
||||
|
||||
Context Analysis Agent Streaming Produces Updates
|
||||
[Documentation] Test streaming workflow execution using helper script
|
||||
${result}= Run Process python3 ${HELPER} streaming
|
||||
${result}= Run Process ${PYTHON} ${HELPER} streaming
|
||||
Log ${result.stdout}
|
||||
Log ${result.stderr}
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
|
||||
@@ -9,13 +9,14 @@ Suite Setup Setup Test Environment
|
||||
Suite Teardown Cleanup Test Environment
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${TEST_DIR} ${TEMPDIR}${/}cleveragents_core_cli_test
|
||||
${PROJECT_NAME} test-project
|
||||
|
||||
*** Test Cases ***
|
||||
Test CLI Help Shows All Commands
|
||||
[Documentation] Verify that CLI help displays all expected command groups
|
||||
${result} = Run Process python -m cleveragents --help timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents --help timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} AI-powered development assistant
|
||||
Should Contain ${result.stdout} project
|
||||
@@ -29,7 +30,7 @@ Test CLI Help Shows All Commands
|
||||
Test Project Initialization
|
||||
[Documentation] Test initializing a new CleverAgents project
|
||||
Create Directory ${TEST_DIR}/project1
|
||||
${result} = Run Process python -m cleveragents init ${PROJECT_NAME}
|
||||
${result} = Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME}
|
||||
... cwd=${TEST_DIR}/project1 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Project '${PROJECT_NAME}' initialized successfully
|
||||
@@ -43,8 +44,8 @@ Test Project Initialization
|
||||
Test Project Cannot Initialize Twice
|
||||
[Documentation] Verify project cannot be initialized twice without force
|
||||
Create Directory ${TEST_DIR}/project2
|
||||
Run Process python -m cleveragents init first-project cwd=${TEST_DIR}/project2 timeout=10s
|
||||
${result} = Run Process python -m cleveragents init second-project
|
||||
Run Process ${PYTHON} -m cleveragents init first-project cwd=${TEST_DIR}/project2 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents init second-project
|
||||
... cwd=${TEST_DIR}/project2 timeout=10s
|
||||
Should Not Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stderr} Project already initialized
|
||||
@@ -53,8 +54,8 @@ Test Project Cannot Initialize Twice
|
||||
Test Force Reinitialize Project
|
||||
[Documentation] Test force reinitialization of a project
|
||||
Create Directory ${TEST_DIR}/project3
|
||||
Run Process python -m cleveragents init first-project cwd=${TEST_DIR}/project3 timeout=10s
|
||||
${result} = Run Process python -m cleveragents init second-project --force
|
||||
Run Process ${PYTHON} -m cleveragents init first-project cwd=${TEST_DIR}/project3 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents init second-project --force
|
||||
... cwd=${TEST_DIR}/project3 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Project 'second-project' initialized successfully
|
||||
@@ -62,9 +63,9 @@ Test Force Reinitialize Project
|
||||
Test Context Add Files
|
||||
[Documentation] Test adding files to context
|
||||
Create Directory ${TEST_DIR}/project4
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project4 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project4 timeout=10s
|
||||
Create File ${TEST_DIR}/project4/test.py print('hello world')
|
||||
${result} = Run Process python -m cleveragents context add test.py
|
||||
${result} = Run Process ${PYTHON} -m cleveragents context add test.py
|
||||
... cwd=${TEST_DIR}/project4 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Added 1 file(s) to context
|
||||
@@ -73,12 +74,12 @@ Test Context Add Files
|
||||
Test Context List Files
|
||||
[Documentation] Test listing context files
|
||||
Create Directory ${TEST_DIR}/project5
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project5 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project5 timeout=10s
|
||||
Create File ${TEST_DIR}/project5/file1.py # File 1
|
||||
Create File ${TEST_DIR}/project5/file2.py # File 2
|
||||
Run Process python -m cleveragents context add file1.py file2.py
|
||||
Run Process ${PYTHON} -m cleveragents context add file1.py file2.py
|
||||
... cwd=${TEST_DIR}/project5 timeout=10s
|
||||
${result} = Run Process python -m cleveragents context list
|
||||
${result} = Run Process ${PYTHON} -m cleveragents context list
|
||||
... cwd=${TEST_DIR}/project5 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} file1.py
|
||||
@@ -87,10 +88,10 @@ Test Context List Files
|
||||
Test Context Clear
|
||||
[Documentation] Test clearing context files
|
||||
Create Directory ${TEST_DIR}/project6
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project6 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project6 timeout=10s
|
||||
Create File ${TEST_DIR}/project6/test.py # Test file
|
||||
Run Process python -m cleveragents context add test.py cwd=${TEST_DIR}/project6 timeout=10s
|
||||
${result} = Run Process python -m cleveragents context clear --yes
|
||||
Run Process ${PYTHON} -m cleveragents context add test.py cwd=${TEST_DIR}/project6 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents context clear --yes
|
||||
... cwd=${TEST_DIR}/project6 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Cleared all files from context
|
||||
@@ -98,8 +99,8 @@ Test Context Clear
|
||||
Test Plan Creation With Tell
|
||||
[Documentation] Test creating a plan using tell command
|
||||
Create Directory ${TEST_DIR}/project7
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project7 timeout=10s
|
||||
${result} = Run Process python -m cleveragents tell Add error handling to main function
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project7 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents tell Add error handling to main function
|
||||
... cwd=${TEST_DIR}/project7 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Plan created
|
||||
@@ -108,9 +109,9 @@ Test Plan Creation With Tell
|
||||
Test Plan Build
|
||||
[Documentation] Test building a plan
|
||||
Create Directory ${TEST_DIR}/project8
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project8 timeout=10s
|
||||
Run Process python -m cleveragents tell Create example code cwd=${TEST_DIR}/project8 timeout=10s
|
||||
${result} = Run Process python -m cleveragents build cwd=${TEST_DIR}/project8
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project8 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents tell Create example code cwd=${TEST_DIR}/project8 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents build cwd=${TEST_DIR}/project8
|
||||
... env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Plan built successfully
|
||||
@@ -120,11 +121,11 @@ Test Plan Build
|
||||
Test Plan Apply
|
||||
[Documentation] Test applying plan changes
|
||||
Create Directory ${TEST_DIR}/project9
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project9 timeout=10s
|
||||
Run Process python -m cleveragents tell Create example file cwd=${TEST_DIR}/project9 timeout=10s
|
||||
Run Process python -m cleveragents build cwd=${TEST_DIR}/project9
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project9 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents tell Create example file cwd=${TEST_DIR}/project9 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents build cwd=${TEST_DIR}/project9
|
||||
... env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
${result} = Run Process python -m cleveragents apply --yes cwd=${TEST_DIR}/project9 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents apply --yes cwd=${TEST_DIR}/project9 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Successfully applied
|
||||
File Should Exist ${TEST_DIR}/project9/example.py
|
||||
@@ -132,20 +133,20 @@ Test Plan Apply
|
||||
Test Plan List
|
||||
[Documentation] Test listing plans
|
||||
Create Directory ${TEST_DIR}/project10
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Run Process python -m cleveragents tell First plan cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Run Process python -m cleveragents plan new second-plan cwd=${TEST_DIR}/project10 timeout=10s
|
||||
${result} = Run Process python -m cleveragents plan list cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents tell First plan cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents plan new second-plan cwd=${TEST_DIR}/project10 timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents plan list cwd=${TEST_DIR}/project10 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Plans (3 total)
|
||||
|
||||
Test Shortcut Commands Work
|
||||
[Documentation] Test that shortcut commands work properly
|
||||
Create Directory ${TEST_DIR}/project11
|
||||
Run Process python -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project11 timeout=10s
|
||||
Run Process ${PYTHON} -m cleveragents init ${PROJECT_NAME} cwd=${TEST_DIR}/project11 timeout=10s
|
||||
Create File ${TEST_DIR}/project11/test.txt Test content
|
||||
# Test context-load shortcut
|
||||
${result} = Run Process python -m cleveragents context-load test.txt
|
||||
${result} = Run Process ${PYTHON} -m cleveragents context-load test.txt
|
||||
... cwd=${TEST_DIR}/project11 timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Added 1 file(s) to context
|
||||
@@ -154,38 +155,38 @@ Test End To End Workflow
|
||||
[Documentation] Test complete workflow from init to apply
|
||||
Create Directory ${TEST_DIR}/project12
|
||||
# Initialize project
|
||||
${init} = Run Process python -m cleveragents init workflow-project
|
||||
${init} = Run Process ${PYTHON} -m cleveragents init workflow-project
|
||||
... cwd=${TEST_DIR}/project12 timeout=10s
|
||||
Should Be Equal As Numbers ${init.rc} 0
|
||||
# Add context
|
||||
Create File ${TEST_DIR}/project12/input.py def main(): pass
|
||||
${add} = Run Process python -m cleveragents context add input.py
|
||||
${add} = Run Process ${PYTHON} -m cleveragents context add input.py
|
||||
... cwd=${TEST_DIR}/project12 timeout=10s
|
||||
Should Be Equal As Numbers ${add.rc} 0
|
||||
# Create plan
|
||||
${tell} = Run Process python -m cleveragents tell Add logging to main function
|
||||
${tell} = Run Process ${PYTHON} -m cleveragents tell Add logging to main function
|
||||
... cwd=${TEST_DIR}/project12 timeout=10s
|
||||
Should Be Equal As Numbers ${tell.rc} 0
|
||||
# Build plan
|
||||
${build} = Run Process python -m cleveragents build cwd=${TEST_DIR}/project12
|
||||
${build} = Run Process ${PYTHON} -m cleveragents build cwd=${TEST_DIR}/project12
|
||||
... env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=10s
|
||||
Should Be Equal As Numbers ${build.rc} 0
|
||||
# Apply changes
|
||||
${apply} = Run Process python -m cleveragents apply --yes cwd=${TEST_DIR}/project12 timeout=10s
|
||||
${apply} = Run Process ${PYTHON} -m cleveragents apply --yes cwd=${TEST_DIR}/project12 timeout=10s
|
||||
Should Be Equal As Numbers ${apply.rc} 0
|
||||
# Verify file created
|
||||
File Should Exist ${TEST_DIR}/project12/example.py
|
||||
|
||||
Test Command Error Handling
|
||||
[Documentation] Test error handling for invalid commands
|
||||
${result} = Run Process python -m cleveragents invalid-command timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents invalid-command timeout=10s
|
||||
Should Not Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stderr} Invalid command
|
||||
|
||||
Test Project Status Without Project
|
||||
[Documentation] Test project status command without initialized project
|
||||
Create Directory ${TEST_DIR}/no_project
|
||||
${result} = Run Process python -m cleveragents project status
|
||||
${result} = Run Process ${PYTHON} -m cleveragents project status
|
||||
... cwd=${TEST_DIR}/no_project timeout=10s
|
||||
Should Not Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stderr} No project found
|
||||
@@ -193,8 +194,8 @@ Test Project Status Without Project
|
||||
Test Project Status With Project
|
||||
[Documentation] Test project status command with initialized project
|
||||
Create Directory ${TEST_DIR}/with_project
|
||||
Run Process python -m cleveragents init status-test cwd=${TEST_DIR}/with_project timeout=10s
|
||||
${result} = Run Process python -m cleveragents project status
|
||||
Run Process ${PYTHON} -m cleveragents init status-test cwd=${TEST_DIR}/with_project timeout=10s
|
||||
${result} = Run Process ${PYTHON} -m cleveragents project status
|
||||
... cwd=${TEST_DIR}/with_project timeout=10s
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Project: status-test
|
||||
|
||||
@@ -7,6 +7,7 @@ Library Process
|
||||
Suite Setup Run Discovery Once
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${PLANDEX_DIR} ${CURDIR}/../plandex
|
||||
${OUTPUT_DIR} ${CURDIR}/../docs/reference/contracts
|
||||
${PYTHON_SCRIPT} ${CURDIR}/../src/cleveragents/discovery/run_all.py
|
||||
@@ -15,7 +16,7 @@ ${PYTHON_SCRIPT} ${CURDIR}/../src/cleveragents/discovery/run_all.py
|
||||
Run Discovery Once
|
||||
[Documentation] Run the discovery script once for all tests
|
||||
[Tags] discovery
|
||||
${result}= Run Process python ${PYTHON_SCRIPT} cwd=${CURDIR}/..
|
||||
${result}= Run Process ${PYTHON} ${PYTHON_SCRIPT} cwd=${CURDIR}/..
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Set Suite Variable ${DISCOVERY_OUTPUT} ${result.stdout}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Library indentation_library.py
|
||||
Resource common.resource
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${TEST_PROJECT_NAME} test-db-project
|
||||
${TEST_PLAN_NAME} test-plan
|
||||
${TEST_FILE} test_file.py
|
||||
@@ -753,7 +754,7 @@ Run Python Script
|
||||
# Write to a temporary file
|
||||
${temp_file}= Evaluate __import__('tempfile').NamedTemporaryFile(mode='w', suffix='.py', delete=False, dir='/tmp').name
|
||||
Create File ${temp_file} ${full_code}
|
||||
${result}= Run Process /usr/local/bin/python ${temp_file} timeout=10s stderr=STDOUT env:PYTHONWARNINGS=ignore env:PYTHONDONTWRITEBYTECODE=1 env:PATH=/usr/local/bin:/usr/bin:/bin
|
||||
${result}= Run Process ${PYTHON} ${temp_file} timeout=10s stderr=STDOUT env:PYTHONWARNINGS=ignore env:PYTHONDONTWRITEBYTECODE=1
|
||||
Remove File ${temp_file}
|
||||
# Check if process failed and log stderr if present
|
||||
IF ${result.rc} != 0
|
||||
|
||||
@@ -5,6 +5,7 @@ Library Process
|
||||
Library String
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${PROJECT_DIR} /app
|
||||
${DISCOVERY_DIR} ${PROJECT_DIR}/src/cleveragents/discovery
|
||||
${DOCS_DIR} ${PROJECT_DIR}/docs/reference
|
||||
@@ -13,7 +14,7 @@ ${DOCS_DIR} ${PROJECT_DIR}/docs/reference
|
||||
Run Discovery Tool Suite
|
||||
[Documentation] Test running the complete discovery tool suite
|
||||
[Tags] discovery
|
||||
${result}= Run Process python ${DISCOVERY_DIR}/run_all.py cwd=${PROJECT_DIR}
|
||||
${result}= Run Process ${PYTHON} ${DISCOVERY_DIR}/run_all.py cwd=${PROJECT_DIR}
|
||||
Should Contain ${result.stdout} CleverAgents Discovery Tool Suite
|
||||
Should Contain ${result.stdout} ✓ Extracted
|
||||
Should Contain ${result.stdout} commands
|
||||
@@ -22,7 +23,7 @@ Run Discovery Tool Suite
|
||||
Extract CLI Inventory
|
||||
[Documentation] Test CLI inventory extraction directly
|
||||
[Tags] discovery
|
||||
${result}= Run Process python -m cleveragents.discovery.cli_inventory cwd=${PROJECT_DIR}
|
||||
${result}= Run Process ${PYTHON} -m cleveragents.discovery.cli_inventory cwd=${PROJECT_DIR}
|
||||
Should Contain ${result.stdout} Extracting CLI command metadata
|
||||
Should Contain ${result.stdout} Extracted
|
||||
Should Contain ${result.stdout} commands
|
||||
@@ -70,7 +71,7 @@ Discovery Tool Performance
|
||||
[Documentation] Benchmark discovery tool performance
|
||||
[Tags] discovery
|
||||
${start_time}= Get Time epoch
|
||||
${result}= Run Process python -m cleveragents.discovery.cli_inventory cwd=${PROJECT_DIR}
|
||||
${result}= Run Process ${PYTHON} -m cleveragents.discovery.cli_inventory cwd=${PROJECT_DIR}
|
||||
${end_time}= Get Time epoch
|
||||
${elapsed}= Evaluate ${end_time} - ${start_time}
|
||||
|
||||
@@ -81,14 +82,14 @@ Discovery Tool Performance
|
||||
Test Import Discovery Module
|
||||
[Documentation] Test that discovery module can be imported
|
||||
[Tags] discovery
|
||||
${result}= Run Process python -c import cleveragents.discovery; print('OK') cwd=${PROJECT_DIR}
|
||||
${result}= Run Process ${PYTHON} -c import cleveragents.discovery; print('OK') cwd=${PROJECT_DIR}
|
||||
Should Contain ${result.stdout} OK
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
Test Discovery Module Has Expected Classes
|
||||
[Documentation] Verify discovery module exports expected classes
|
||||
[Tags] discovery
|
||||
${result}= Run Process python -c from cleveragents.discovery import CLIInventoryExtractor, DataContractExtractor, EnvironmentVariableExtractor, ImplicitBehaviorExtractor, ServerEndpointExtractor, ShellAssetExtractor; print(' '.join([CLIInventoryExtractor.__name__, DataContractExtractor.__name__, EnvironmentVariableExtractor.__name__, ImplicitBehaviorExtractor.__name__, ServerEndpointExtractor.__name__, ShellAssetExtractor.__name__])) cwd=${PROJECT_DIR}
|
||||
${result}= Run Process ${PYTHON} -c from cleveragents.discovery import CLIInventoryExtractor, DataContractExtractor, EnvironmentVariableExtractor, ImplicitBehaviorExtractor, ServerEndpointExtractor, ShellAssetExtractor; print(' '.join([CLIInventoryExtractor.__name__, DataContractExtractor.__name__, EnvironmentVariableExtractor.__name__, ImplicitBehaviorExtractor.__name__, ServerEndpointExtractor.__name__, ShellAssetExtractor.__name__])) cwd=${PROJECT_DIR}
|
||||
Should Contain ${result.stdout} CLIInventoryExtractor
|
||||
Should Contain ${result.stdout} DataContractExtractor
|
||||
Should Contain ${result.stdout} EnvironmentVariableExtractor
|
||||
|
||||
@@ -6,6 +6,7 @@ Library String
|
||||
Resource discovery_common.resource
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${ENV_JSON} ${OUTPUT_DIR}/env_variables.json
|
||||
${ENV_YAML} ${OUTPUT_DIR}/env_variables.yaml
|
||||
${ENV_MAPPING} ${OUTPUT_DIR}/env_mapping.txt
|
||||
@@ -17,7 +18,7 @@ Extract Environment Variables from Documentation
|
||||
[Tags] discovery environment
|
||||
|
||||
# Run extraction
|
||||
${result}= Run Process python -m cleveragents.discovery.env_variables
|
||||
${result}= Run Process ${PYTHON} -m cleveragents.discovery.env_variables
|
||||
... ${PLANDEX_DIR} --output ${OUTPUT_DIR}
|
||||
... cwd=${WORK_DIR}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ Resource discovery_common.resource
|
||||
Suite Setup Run Discovery Once
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${WORK_DIR} ${CURDIR}/..
|
||||
${PYTHON_SCRIPT} ${WORK_DIR}/src/cleveragents/discovery/run_all.py
|
||||
${OUTPUT_DIR} ${WORK_DIR}/docs/reference/behaviors
|
||||
@@ -19,7 +20,7 @@ ${OUTPUT_MD} ${OUTPUT_DIR}/implicit_behaviors.md
|
||||
*** Keywords ***
|
||||
Run Discovery Once
|
||||
[Documentation] Execute discovery script once for all tests
|
||||
${result}= Run Process python ${PYTHON_SCRIPT} cwd=${WORK_DIR}
|
||||
${result}= Run Process ${PYTHON} ${PYTHON_SCRIPT} cwd=${WORK_DIR}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Extracting Implicit Runtime Behaviors
|
||||
Set Suite Variable ${DISCOVERY_RAN} ${TRUE}
|
||||
|
||||
@@ -6,6 +6,7 @@ Library Collections
|
||||
Library String
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${SRC_DIR} ${CURDIR}/../src
|
||||
${TEST_PROJECT} test_plan_generation_project
|
||||
|
||||
@@ -13,7 +14,7 @@ ${TEST_PROJECT} test_plan_generation_project
|
||||
|
||||
Plan Generation Graph Module Can Be Imported
|
||||
[Documentation] Verify the plan generation module can be imported
|
||||
${result}= Run Process python3 -c
|
||||
${result}= Run Process ${PYTHON} -c
|
||||
... import sys; sys.path.insert(0, '${SRC_DIR}'); from cleveragents.agents.plan_generation import PlanGenerationGraph; print('SUCCESS')
|
||||
... shell=True
|
||||
Should Contain ${result.stdout} SUCCESS
|
||||
@@ -30,7 +31,7 @@ Plan Generation Graph Can Be Instantiated With Default Parameters
|
||||
... assert graph.max_retries == 3
|
||||
... assert graph.llm is not None
|
||||
... print('Graph initialized successfully')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} initialized successfully
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -43,7 +44,7 @@ Plan Generation Graph Can Be Instantiated With Custom Max Retries
|
||||
... graph = PlanGenerationGraph(max_retries=5)
|
||||
... assert graph.max_retries == 5
|
||||
... print('Max retries: ' + str(graph.max_retries))
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Max retries: 5
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -60,7 +61,7 @@ Plan Generation Graph Creates Prompt Templates
|
||||
... assert 'prompt' in graph.analyze_prompt.input_variables
|
||||
... assert 'context_summary' in graph.analyze_prompt.input_variables
|
||||
... print('All prompts configured')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} All prompts configured
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -77,7 +78,7 @@ Plan Generation Graph Builds Workflow With Correct Nodes
|
||||
... assert 'generate_plan' in nodes
|
||||
... assert 'validate' in nodes
|
||||
... print(f'Graph has {len(nodes)} nodes')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Graph has 4 nodes
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -95,7 +96,7 @@ LangGraph Graphs Package Exports Workflow Classes
|
||||
... assert PlanGenerationGraph is ExportedPlanGraph
|
||||
... assert ContextAnalysisAgent is ExportedContextAgent
|
||||
... print('LangGraph graphs exports verified')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} LangGraph graphs exports verified
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -109,7 +110,7 @@ Format Context Summary With No Files Returns Appropriate Message
|
||||
... summary = graph._format_context_summary([])
|
||||
... assert summary == 'No context files provided'
|
||||
... print('Empty context handled correctly')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Empty context handled correctly
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -130,7 +131,7 @@ Format Context Summary With Multiple Files
|
||||
... assert 'file2.py' in summary
|
||||
... assert 'File:' in summary
|
||||
... print('Multiple files formatted correctly')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Multiple files formatted correctly
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -148,7 +149,7 @@ Format Context Summary Limits To Five Files
|
||||
... assert 'file4.py' in summary
|
||||
... assert 'and 3 more files' in summary
|
||||
... print('File limiting works correctly')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} File limiting works correctly
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -165,7 +166,7 @@ Load Context Node Initializes State
|
||||
... assert result['retry_count'] == 0
|
||||
... assert result['error'] is None
|
||||
... print('Load context node works')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Load context node works
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -184,7 +185,7 @@ Should Retry Returns Retry When Validation Fails And Retries Available
|
||||
... assert decision == 'retry'
|
||||
... assert state['retry_count'] == 1
|
||||
... print('Should retry: retry decision correct')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Should retry: retry decision correct
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -202,7 +203,7 @@ Should Retry Returns End When Validation Passes
|
||||
... decision = graph._should_retry(state)
|
||||
... assert decision == 'end'
|
||||
... print('Should retry: end decision correct')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Should retry: end decision correct
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -220,7 +221,7 @@ Should Retry Returns End When Max Retries Reached
|
||||
... decision = graph._should_retry(state)
|
||||
... assert decision == 'end'
|
||||
... print('Should retry: max retries respected')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Should retry: max retries respected
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -241,7 +242,7 @@ Plan Generation State TypedDict Has Correct Structure
|
||||
... assert 'retry_count' in annotations
|
||||
... assert 'error' in annotations
|
||||
... print('PlanGenerationState structure verified')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} PlanGenerationState structure verified
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -257,7 +258,7 @@ Validate Node Fails When No Changes Provided
|
||||
... assert result['validation_result']['status'] == 'FAIL'
|
||||
... assert 'No changes to validate' in result['validation_result']['message']
|
||||
... print('Validate correctly handles empty changes')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Validate correctly handles empty changes
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -273,7 +274,7 @@ Generate Plan Handles Missing Requirements
|
||||
... assert result['generated_changes'] == []
|
||||
... assert 'No requirements to generate from' in result['error']
|
||||
... print('Generate plan handles missing requirements')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Generate plan handles missing requirements
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -301,7 +302,7 @@ Generate Plan Infers Test File Name From Prompt
|
||||
... assert len(result['generated_changes']) > 0
|
||||
... assert result['generated_changes'][0].file_path == 'test_generated.py'
|
||||
... print('Test file name inferred correctly')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Test file name inferred correctly
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -328,7 +329,7 @@ Generate Plan Infers Error Handler File Name From Prompt
|
||||
... result = graph._generate_plan(state)
|
||||
... assert result['generated_changes'][0].file_path == 'error_handler.py'
|
||||
... print('Error handler file name inferred')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Error handler file name inferred
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -352,7 +353,7 @@ Workflow Invoke Method Returns Complete State
|
||||
... assert 'validation_result' in result
|
||||
... assert 'retry_count' in result
|
||||
... print('Workflow invoke completes successfully')
|
||||
${result}= Run Process python3 -c ${script} shell=True timeout=30s
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True timeout=30s
|
||||
Should Contain ${result.stdout} Workflow invoke completes successfully
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
@@ -372,7 +373,7 @@ Workflow Stream Method Yields Events
|
||||
... assert len(events) > 0
|
||||
... assert all(isinstance(e, dict) for e in events)
|
||||
... print(f'Stream yielded {len(events)} events')
|
||||
${result}= Run Process python3 -c ${script} shell=True timeout=30s
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True timeout=30s
|
||||
Should Contain ${result.stdout} Stream yielded
|
||||
Should Contain ${result.stdout} events
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
@@ -389,7 +390,7 @@ Graph Has Checkpointer For State Persistence
|
||||
... assert isinstance(graph.checkpointer, MemorySaver)
|
||||
... assert graph.app is not None
|
||||
... print('Checkpointer configured correctly')
|
||||
${result}= Run Process python3 -c ${script} shell=True
|
||||
${result}= Run Process ${PYTHON} -c ${script} shell=True
|
||||
Should Contain ${result.stdout} Checkpointer configured correctly
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
|
||||
|
||||
+12
-11
@@ -14,6 +14,7 @@ Test Setup Setup Retry Test Environment
|
||||
Test Teardown Cleanup Retry Test Environment
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${WORKSPACE_ROOT} ${CURDIR}/..
|
||||
${RETRY_TEST_FILE} ${EMPTY}
|
||||
${RETRY_OUTPUT} ${EMPTY}
|
||||
@@ -24,7 +25,7 @@ ${TIMEOUT} 30s
|
||||
Test Exponential Backoff Retry Pattern
|
||||
[Documentation] Verify exponential backoff retry works correctly
|
||||
Create Retry Test Script exponential_backoff
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -36,7 +37,7 @@ Test Exponential Backoff Retry Pattern
|
||||
Test Async Exponential Backoff Pattern
|
||||
[Documentation] Verify async exponential backoff retry works correctly
|
||||
Create Async Retry Test Script async_exponential_backoff
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -47,7 +48,7 @@ Test Async Exponential Backoff Pattern
|
||||
Test Network Retry Pattern
|
||||
[Documentation] Test network-specific retry with NetworkError
|
||||
Create Network Error Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -58,7 +59,7 @@ Test Network Retry Pattern
|
||||
Test Provider Retry Pattern With Rate Limiting
|
||||
[Documentation] Test provider retry with RateLimitError and jitter
|
||||
Create Rate Limit Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -69,7 +70,7 @@ Test Provider Retry Pattern With Rate Limiting
|
||||
Test Circuit Breaker Opens After Threshold
|
||||
[Documentation] Verify circuit breaker opens after failure threshold
|
||||
Create Circuit Breaker Test Script open
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -79,7 +80,7 @@ Test Circuit Breaker Opens After Threshold
|
||||
Test Circuit Breaker Recovery
|
||||
[Documentation] Verify circuit breaker recovers to half-open then closed
|
||||
Create Circuit Breaker Test Script recovery
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -90,7 +91,7 @@ Test Circuit Breaker Recovery
|
||||
Test Retry Context Manager
|
||||
[Documentation] Test RetryContext for tracking retry attempts
|
||||
Create Retry Context Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -101,7 +102,7 @@ Test Retry Context Manager
|
||||
Test Auto Debug Retry Pattern
|
||||
[Documentation] Test auto-debug retry with debug callback
|
||||
Create Auto Debug Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -113,7 +114,7 @@ Test Auto Debug Retry Pattern
|
||||
Test Retry With Timeout
|
||||
[Documentation] Test retry with overall timeout limit
|
||||
Create Timeout Retry Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
# This should fail due to timeout
|
||||
Should Not Be Equal As Integers ${result.rc} 0
|
||||
@@ -123,7 +124,7 @@ Test Retry With Timeout
|
||||
Test Category-Specific Retry Decorators
|
||||
[Documentation] Test all category-specific retry patterns
|
||||
Create Category Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
@@ -135,7 +136,7 @@ Test Category-Specific Retry Decorators
|
||||
Test Concurrent Retries With Jitter
|
||||
[Documentation] Test multiple concurrent operations with jitter
|
||||
Create Concurrent Retry Test Script
|
||||
${result} = Run Process python ${RETRY_TEST_FILE}
|
||||
${result} = Run Process ${PYTHON} ${RETRY_TEST_FILE}
|
||||
... stdout=${RETRY_OUTPUT} stderr=STDOUT timeout=${TIMEOUT}
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
${output} = Get File ${RETRY_OUTPUT}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
*** Settings ***
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
Documentation Test suite for server endpoint discovery functionality
|
||||
Library OperatingSystem
|
||||
Library Collections
|
||||
@@ -8,7 +11,7 @@ Library Process
|
||||
Server Endpoint Extraction Should Work
|
||||
[Documentation] Test that server endpoint extraction runs successfully
|
||||
[Tags] discovery
|
||||
${result}= Run Process python -m cleveragents.discovery.server_endpoints cwd=/app
|
||||
${result}= Run Process ${PYTHON} -m cleveragents.discovery.server_endpoints cwd=/app
|
||||
Should Be Equal As Integers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Server Endpoint Extraction Complete
|
||||
Should Contain ${result.stdout} Total endpoints:
|
||||
|
||||
@@ -6,6 +6,7 @@ Library Process
|
||||
Library String
|
||||
|
||||
*** Variables ***
|
||||
${PYTHON} python
|
||||
${SHELL_ASSETS_JSON} docs/reference/shell_assets.json
|
||||
${SHELL_ASSETS_YAML} docs/reference/shell_assets.yaml
|
||||
${WRAPPERS_DIR} docs/reference/shell_wrappers
|
||||
@@ -14,7 +15,7 @@ ${WRAPPERS_DIR} docs/reference/shell_wrappers
|
||||
Run Shell Asset Extraction
|
||||
[Documentation] Test running the shell asset extraction tool
|
||||
[Tags] discovery shell
|
||||
${result}= Run Process python -m cleveragents.discovery.shell_assets cwd=${CURDIR}/..
|
||||
${result}= Run Process ${PYTHON} -m cleveragents.discovery.shell_assets cwd=${CURDIR}/..
|
||||
Should Be Equal As Numbers ${result.rc} 0
|
||||
Should Contain ${result.stdout} Shell Asset Extraction Summary
|
||||
Should Contain ${result.stdout} Total scripts found
|
||||
|
||||
Reference in New Issue
Block a user