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
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""Register every invocation before launching pytest, including startup errors."""
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
root = Path(__file__).resolve().parents[3] / ".hermes/test-runtime/unified-execution/b04-control"
|
|
root.mkdir(parents=True, exist_ok=True)
|
|
nodes = sys.argv[2:]
|
|
for node in nodes:
|
|
path = root / (node + ".jsonl")
|
|
records = path.read_text().splitlines() if path.exists() else []
|
|
assert len(records) < 5, "node budget exhausted"
|
|
for node in nodes:
|
|
path = root / (node + ".jsonl")
|
|
used = len(path.read_text().splitlines()) if path.exists() else 0
|
|
with path.open("a") as out:
|
|
out.write(json.dumps(dict(node=node, attempt=used + 1, phase=sys.argv[1])) + "\n")
|
|
out.flush()
|
|
os.fsync(out.fileno())
|
|
result = subprocess.run([sys.executable, "-m", "pytest", "-q", *[
|
|
"tests/test_host_registry_control.py::test_" + node for node in nodes
|
|
]], capture_output=True, text=True)
|
|
print(result.stdout, end="")
|
|
print(result.stderr, end="", file=sys.stderr)
|
|
(root / (sys.argv[1] + "-" + "-".join(nodes) + ".txt")).write_text(result.stdout + result.stderr)
|
|
sys.exit(result.returncode) |