45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SCRIPT = ROOT / "scripts" / "check_1c_moxel_next_action.py"
|
|
SPEC = importlib.util.spec_from_file_location("check_1c_moxel_next_action", SCRIPT)
|
|
assert SPEC and SPEC.loader
|
|
check = importlib.util.module_from_spec(SPEC)
|
|
SPEC.loader.exec_module(check)
|
|
|
|
|
|
def plan() -> dict:
|
|
return {"experiments": [{"id": "named_range_rectangular_area", "target": "named_range"}]}
|
|
|
|
|
|
def action(command: str) -> dict:
|
|
return {
|
|
"schema": "codex_1c_moxel_next_action.v1",
|
|
"status": "ok",
|
|
"action": {
|
|
"id": "named_range_rectangular_area",
|
|
"target": "named_range",
|
|
"manual_action": "Create range.",
|
|
"expected_signal": "Distinct raw scalars.",
|
|
"capture_command_with_pipeline": command,
|
|
},
|
|
}
|
|
|
|
|
|
def test_check_next_action_accepts_valid_action() -> None:
|
|
report = check.check_next_action(plan(), action("python watcher.py --run-pipeline-after"))
|
|
|
|
assert report["status"] == "ok"
|
|
assert report["failures"] == []
|
|
|
|
|
|
def test_check_next_action_requires_pipeline_flag() -> None:
|
|
report = check.check_next_action(plan(), action("python watcher.py"))
|
|
|
|
assert report["status"] == "failed"
|
|
assert "capture_command_with_pipeline must include --run-pipeline-after" in report["failures"]
|