forked from cleveragents/cleveragents-core
45 lines
1.9 KiB
Plaintext
45 lines
1.9 KiB
Plaintext
*** Settings ***
|
|
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} will be set dynamically in Setup Test Environment
|
|
|
|
*** Keywords ***
|
|
Setup Test Environment
|
|
[Documentation] Setup common test environment
|
|
Log Setting up test environment
|
|
${safe_suite}= Replace String ${SUITE NAME} ${SPACE} _
|
|
${home}= Set Variable ${TEMPDIR}${/}.cleveragents_${safe_suite}
|
|
Run Keyword And Ignore Error Remove Directory ${home} recursive=True
|
|
Create Directory ${home}
|
|
Set Environment Variable CLEVERAGENTS_HOME ${home}
|
|
Run Keyword And Ignore Error Remove Directory ${TEMPDIR}${/}.cleveragents recursive=True
|
|
# Get the actual Python executable being used
|
|
${python_exec}= Evaluate sys.executable sys
|
|
Set Suite Variable ${PYTHON} ${python_exec}
|
|
# Don't set AGENTS_EXECUTABLE as a single variable - we'll use ${PYTHON} -m cleveragents directly
|
|
|
|
Cleanup Test Environment
|
|
[Documentation] Clean up after tests
|
|
Log Cleaning up test environment
|
|
|
|
File Should Contain Pattern
|
|
[Arguments] ${file_path} ${pattern}
|
|
[Documentation] Check if file contains a pattern
|
|
${content}= Get File ${file_path}
|
|
Should Contain ${content} ${pattern}
|
|
|
|
Count Files With Extension
|
|
[Arguments] ${directory} ${extension}
|
|
[Documentation] Count files with specific extension
|
|
@{files}= List Files In Directory ${directory} *.${extension} recursive=True
|
|
${count}= Get Length ${files}
|
|
RETURN ${count} |