33 lines
942 B
Python
33 lines
942 B
Python
"""Canonical flows must pass lfx's strict validator (level 4).
|
|
|
|
Guards the source-of-truth directory against authoring mistakes: the
|
|
input_schema parser and the LFX runtime both assume well-formed exports.
|
|
Runs `lfx validate --level 4` (the dev dep, same minor as Langflow).
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
FLOW_DIR = Path(__file__).resolve().parent.parent / "flows"
|
|
|
|
|
|
def test_canonical_flows_pass_lfx_validate():
|
|
files = sorted(FLOW_DIR.glob("*.json"))
|
|
assert files, "no canonical flows found"
|
|
process = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
"-m",
|
|
"lfx",
|
|
"validate",
|
|
"--level",
|
|
"4",
|
|
*[str(f) for f in files],
|
|
],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=300,
|
|
check=False,
|
|
)
|
|
assert process.returncode == 0, f"lfx validate failed:\n{process.stdout}\n{process.stderr}"
|