Files
EvoScientist-Multi/tests/support/run_embedding_contract.py
T
m4 d4b53bfb08
Docker / build (push) Has been cancelled
Test / pytest (ubuntu-latest, 3.12) (push) Has been cancelled
Test / pytest (windows-latest, 3.11) (push) Has been cancelled
Test / pytest (windows-latest, 3.12) (push) Has been cancelled
Lint / ruff (push) Has been cancelled
Test / pytest (ubuntu-latest, 3.11) (push) Has been cancelled
Build / build (push) Has been cancelled
test: cover stop contract, execution adapters, checkpointer race and runtime identity
2026-09-13 15:12:17 +08:00

46 lines
2.2 KiB
Python

"""Isolated B01 runner with durable per-attempt evidence, maximum three runs."""
import datetime
import json
import os
from pathlib import Path
import subprocess
import sys
repo = Path(__file__).resolve().parents[2]
root = repo.parent / ".hermes/test-runtime/unified-execution/b01"
root.mkdir(parents=True, exist_ok=True)
ledger = root / "attempts.jsonl"
attempts = ledger.read_text().splitlines() if ledger.exists() else []
if len(attempts) >= 3:
raise SystemExit("B01 budget exhausted")
attempt = len(attempts) + 1
home = root / f"attempt-{attempt}"
config = home / "config"
config.mkdir(parents=True, exist_ok=True)
(config / "settings.yaml").write_text("enable_async_subagents: false\nenable_scheduler: false\nmemory_workers_enabled: false\n")
env = {
"HOME": str(home), "PATH": str(repo / ".venv/bin") + ":/usr/bin:/bin",
"PYTHONPATH": str(repo), "PYTHON_DOTENV_DISABLED": "1",
"PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", "PYTHONDONTWRITEBYTECODE": "1",
"EVOSCIENTIST_HOME": str(home), "EVOSCIENTIST_CONFIG_DIR": str(config),
"XDG_CONFIG_HOME": str(config), "EVOSCIENTIST_DATA_DIR": str(home / "data"),
"EVOSCIENTIST_WORKSPACE_DIR": str(home / "workspace"),
"EVOSCIENTIST_SKILLS_DIR": str(home / "skills"),
"EVOSCIENTIST_MEMORIES_DIR": str(home / "memory"),
}
nodes = [
"test_explicit_web_factory_preserves_environment_and_globals",
"test_two_tenants_real_file_tools_and_sqlite_reopen",
"test_web_manual_execute_interrupts_before_backend",
]
command = [str(repo / ".venv/bin/python"), "-m", "pytest", "--noconftest", "-p", "no:cacheprovider", "-q", "--tb=short"]
command += ["tests/test_execution_adapter_embedding.py::" + n for n in nodes]
record = {"attempt": attempt, "started": datetime.datetime.now().isoformat(), "nodes": nodes, "command": command, "cwd": str(repo)}
with ledger.open("a") as handle:
handle.write(json.dumps(record) + "\n")
result = subprocess.run(command, cwd=repo, env=env, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
log = root / f"attempt-{attempt}.log"
log.write_text(result.stdout)
print(result.stdout)
print(json.dumps({"attempt": attempt, "exit_code": result.returncode, "log": str(log)}))
sys.exit(result.returncode)