test: add pytest verification suite and gitea ci workflow
All checks were successful
CI / test (push) Successful in 48s
All checks were successful
CI / test (push) Successful in 48s
This commit is contained in:
@@ -14,9 +14,10 @@ from .utils import setup_artifacts, setup_logger
|
||||
try:
|
||||
import pyautogui
|
||||
except Exception as import_exc:
|
||||
raise RuntimeError(
|
||||
"pyautogui is required. Install dependencies with: pip install pyautogui pillow"
|
||||
) from import_exc
|
||||
pyautogui = None # type: ignore[assignment]
|
||||
_PYAUTOGUI_IMPORT_ERROR = import_exc
|
||||
else:
|
||||
_PYAUTOGUI_IMPORT_ERROR = None
|
||||
|
||||
|
||||
def create_openai_client(api_key: str) -> OpenAI:
|
||||
@@ -34,6 +35,12 @@ def run_job(
|
||||
event_callback: Callable[[dict[str, Any]], None] | None = None,
|
||||
logger: logging.Logger | None = None,
|
||||
) -> tuple[AgentResult, RunArtifacts]:
|
||||
if pyautogui is None:
|
||||
raise RuntimeError(
|
||||
"pyautogui is required for runtime execution. "
|
||||
"Install dependencies and ensure GUI access. "
|
||||
f"Import error: {_PYAUTOGUI_IMPORT_ERROR}"
|
||||
)
|
||||
pyautogui.FAILSAFE = not no_failsafe
|
||||
pyautogui.PAUSE = 0.05
|
||||
|
||||
@@ -54,4 +61,3 @@ def run_job(
|
||||
result = agent.run(objective)
|
||||
active_logger.info("Run finished. completed=%s elapsed=%.2fs", result.completed, result.ended_at - result.started_at)
|
||||
return result, artifacts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user