e8aa5ac268
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 28s
CI / security (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 15s
CI / integration_tests (pull_request) Failing after 6m25s
CI / build (pull_request) Successful in 15s
CI / unit_tests (pull_request) Successful in 6m52s
CI / docker (pull_request) Successful in 9s
CI / coverage (pull_request) Successful in 5m5s
- Restore session.env["PATH"] in integration_tests nox session to ensure
Run Process uses venv Python instead of system Python
- Convert bare Resource references to ${CURDIR}/ absolute paths across
30 robot files to fix CI resolution failures
- Add timeout=30s to all Run Process calls in rxpy_route_validation.robot
to prevent hanging tests
- Tag 2 rxpy tests as slow (require running actors unavailable on CI)
- Fix LangGraph test to use correct config file (LANGGRAPH_CONFIG)
- All 204 tests pass (4 excluded: 2 slow + 2 discovery)
196 lines
8.2 KiB
Plaintext
196 lines
8.2 KiB
Plaintext
*** Settings ***
|
|
Documentation Actor-first context management tests for CleverAgents CLI
|
|
Library Process
|
|
Library OperatingSystem
|
|
Library String
|
|
Library DateTime
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${TEST_PROJECT_DIR} ${TEMPDIR}/test_project_${EMPTY}
|
|
${UNIQUE_ID} ${EMPTY}
|
|
|
|
*** Test Cases ***
|
|
Test Context Commands With Actor
|
|
[Documentation] Verify context commands work with actor-first approach
|
|
|
|
# Initialize project first
|
|
Create Directory ${TEST_PROJECT_DIR}
|
|
${result} = Run Process ${PYTHON} -m cleveragents init test-project
|
|
... cwd=${TEST_PROJECT_DIR}
|
|
Log Init stdout: ${result.stdout}
|
|
Log Init stderr: ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Create test files
|
|
Create Directory ${TEST_PROJECT_DIR}/src
|
|
Create File ${TEST_PROJECT_DIR}/src/main.py print("Hello World")
|
|
|
|
# Load context with actor (simulating with environment variable)
|
|
Set Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI true
|
|
Set Environment Variable CLEVERAGENTS_DEFAULT_ACTOR openai/gpt-4
|
|
|
|
${result} = Run Process ${PYTHON} -m cleveragents context-load src/
|
|
... cwd=${TEST_PROJECT_DIR}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# List contexts
|
|
${result} = Run Process ${PYTHON} -m cleveragents context list
|
|
... cwd=${TEST_PROJECT_DIR}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} main.py
|
|
|
|
Test Plan Creation With Actor
|
|
[Documentation] Test plan creation using actor instead of provider/model
|
|
|
|
# Initialize project
|
|
Create Directory ${TEST_PROJECT_DIR}_plan
|
|
${result} = Run Process ${PYTHON} -m cleveragents init test-plan-project
|
|
... cwd=${TEST_PROJECT_DIR}_plan
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Create plan with actor
|
|
Set Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI true
|
|
Set Environment Variable CLEVERAGENTS_DEFAULT_ACTOR anthropic/claude-3
|
|
|
|
${result} = Run Process ${PYTHON} -m cleveragents tell Create a hello world function
|
|
... cwd=${TEST_PROJECT_DIR}_plan env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Log Tell stdout: ${result.stdout}
|
|
Log Tell stderr: ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} Plan
|
|
|
|
Test Actor-Based Workflow
|
|
[Documentation] Test complete workflow with actor configuration
|
|
|
|
# Initialize
|
|
${project_dir} = Set Variable ${TEST_PROJECT_DIR}_workflow
|
|
Create Directory ${project_dir}
|
|
${result} = Run Process ${PYTHON} -m cleveragents init workflow-project
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Set up actor environment
|
|
Set Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI true
|
|
Set Environment Variable CLEVERAGENTS_DEFAULT_ACTOR openai/gpt-4
|
|
|
|
# Add context
|
|
Create File ${project_dir}/test.py def hello():\n${SPACE*4}pass
|
|
${result} = Run Process ${PYTHON} -m cleveragents context-load test.py
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Create plan
|
|
${result} = Run Process ${PYTHON} -m cleveragents tell Add docstring to hello function
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Build plan
|
|
${result} = Run Process ${PYTHON} -m cleveragents build
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true timeout=30s
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Apply changes
|
|
${result} = Run Process ${PYTHON} -m cleveragents apply
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
Test Multiple Actors In Project
|
|
[Documentation] Test switching between actors in a project
|
|
|
|
${project_dir} = Set Variable ${TEST_PROJECT_DIR}_multi_actor
|
|
|
|
# Initialize
|
|
Create Directory ${project_dir}
|
|
${result} = Run Process ${PYTHON} -m cleveragents init multi-actor-project
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
Set Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI true
|
|
|
|
# Create plan with first actor
|
|
Set Environment Variable CLEVERAGENTS_DEFAULT_ACTOR openai/gpt-3.5-turbo
|
|
${result} = Run Process ${PYTHON} -m cleveragents tell Create function A --name plan1
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Create plan with second actor
|
|
Set Environment Variable CLEVERAGENTS_DEFAULT_ACTOR anthropic/claude-3
|
|
${result} = Run Process ${PYTHON} -m cleveragents tell Create function B --name plan2
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# List plans
|
|
${result} = Run Process ${PYTHON} -m cleveragents plan list
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} plan1
|
|
Should Contain ${result.stdout} plan2
|
|
|
|
Test Context Clear Command
|
|
[Documentation] Test clearing all contexts
|
|
|
|
${project_dir} = Set Variable ${TEST_PROJECT_DIR}_clear
|
|
|
|
# Initialize and add contexts
|
|
Create Directory ${project_dir}
|
|
${result} = Run Process ${PYTHON} -m cleveragents init clear-project
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
Set Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI true
|
|
|
|
# Create a plan first
|
|
${result} = Run Process ${PYTHON} -m cleveragents tell Test clearing contexts
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
Create File ${project_dir}/file1.py # test file 1
|
|
Create File ${project_dir}/file2.py # test file 2
|
|
|
|
${result} = Run Process ${PYTHON} -m cleveragents context-load file1.py file2.py
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Clear contexts
|
|
${result} = Run Process ${PYTHON} -m cleveragents context clear --yes
|
|
... cwd=${project_dir} env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
|
|
Log Clear stdout: ${result.stdout}
|
|
Log Clear stderr: ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
|
|
# Verify contexts are cleared
|
|
${result} = Run Process ${PYTHON} -m cleveragents context list
|
|
... cwd=${project_dir}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Not Contain ${result.stdout} file1.py
|
|
Should Not Contain ${result.stdout} file2.py
|
|
|
|
*** Keywords ***
|
|
Setup Test Environment
|
|
[Documentation] Create test environment
|
|
# First run the common setup
|
|
common.Setup Test Environment
|
|
|
|
${timestamp} = Get Current Date result_format=%Y%m%d%H%M%S
|
|
${random} = Generate Random String 6 [NUMBERS]
|
|
Set Suite Variable ${UNIQUE_ID} ${timestamp}_${random}
|
|
|
|
# Create temp directory
|
|
${temp} = Evaluate tempfile.mkdtemp() modules=tempfile
|
|
Set Suite Variable ${TEMP} ${temp}
|
|
Create Directory ${TEMP}
|
|
|
|
# Update TEST_PROJECT_DIR with unique ID
|
|
Set Suite Variable ${TEST_PROJECT_DIR} ${TEMP}/test_project_${UNIQUE_ID}
|
|
|
|
Log Test environment created with ID: ${UNIQUE_ID}
|
|
|
|
Cleanup Test Environment
|
|
[Documentation] Clean up test environment
|
|
Run Keyword If '${TEMP}' != '${EMPTY}' Remove Directory ${TEMP} recursive=True
|
|
Remove Environment Variable CLEVERAGENTS_TESTING_USE_MOCK_AI
|
|
Remove Environment Variable CLEVERAGENTS_DEFAULT_ACTOR
|