feat: add shared test acceptance and release 1.5.0
This commit is contained in:
1 parent
3fbcdfefea
commit
ec2c1265d3
35 files changed
+826
-51
No files matched your search
@@ -6,6 +6,7 @@ from pathlib import Path
|
||||
import uuid
|
||||
|
||||
from artemis.config import TRACES_PATH
|
||||
from artemis.runtime.case_result import resolve_case_result
|
||||
|
||||
|
||||
def read_worker_outcome(session_id: str) -> dict:
|
||||
@@ -37,12 +38,19 @@ def save_failure_result(session_id: str, error: str, *, code: str = "execution_f
|
||||
directory = TRACES_PATH / session_id
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
payload: dict = {}
|
||||
try:
|
||||
previous = json.loads((directory / "result.json").read_text(encoding="utf-8"))
|
||||
if isinstance(previous, dict):
|
||||
payload.update(previous)
|
||||
except (OSError, ValueError):
|
||||
pass # Missing/truncated results are expected after a killed worker.
|
||||
for name in ("result.json", "run_outcome.json"):
|
||||
try:
|
||||
previous = json.loads((directory / name).read_text(encoding="utf-8"))
|
||||
if isinstance(previous, dict):
|
||||
prior_result = resolve_case_result(payload, "failed")
|
||||
prior_tests = payload.get("tests")
|
||||
payload.update(previous)
|
||||
if isinstance(prior_tests, dict) and isinstance(previous.get("tests"), dict):
|
||||
payload["tests"] = {**prior_tests, **previous["tests"]}
|
||||
if prior_result and prior_result.status == "failed":
|
||||
payload["test_result"] = prior_result.model_dump()
|
||||
except (OSError, ValueError):
|
||||
pass # Missing/truncated results are expected after a killed worker.
|
||||
payload.update(
|
||||
{
|
||||
"status": "failed",
|
||||
@@ -54,6 +62,8 @@ def save_failure_result(session_id: str, error: str, *, code: str = "execution_f
|
||||
"tests": payload.get("tests") or {},
|
||||
}
|
||||
)
|
||||
test_result = resolve_case_result(payload, "failed", error)
|
||||
payload["test_result"] = test_result.model_dump() if test_result else None
|
||||
for name in ("result.json", "run_outcome.json"):
|
||||
target = directory / name
|
||||
temporary = target.with_name(f".{name}.{uuid.uuid4().hex}.tmp")
|
||||
|
||||
Reference in new issue
Block a user