117 lines
6.0 KiB
Plaintext
117 lines
6.0 KiB
Plaintext
........................................................................ [ 32%]
|
|
........................................................................ [ 65%]
|
|
.......................F................................................ [ 98%]
|
|
.... [100%]
|
|
=================================== FAILURES ===================================
|
|
_____________ test_whole_graph_mutations_fail_closed[definitions] ______________
|
|
|
|
key = 'definitions'
|
|
|
|
@pytest.mark.parametrize("key", ["extra", "links", "id", "groups", "version", "definitions"])
|
|
def test_whole_graph_mutations_fail_closed(key):
|
|
source, review = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
|
|
source[key] = "forged"
|
|
review["fixed_version_document"]["canonical_sha256"] = hashlib.sha256(
|
|
canonical(source)
|
|
).hexdigest()
|
|
> assert not doc(source, review)["fixed_version"]["matched"]
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
calliope-backend/tests/test_krea_views_fixed_document.py:72:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
calliope-backend/tests/test_krea_views_fixed_document.py:31: in doc
|
|
return build_document(PATH, s, None, None, [], r)
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
calliope-backend/src/calliope/comfyui/library.py:215: in build_document
|
|
inspect(source)
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
graph = {'id': 'c746b6b5-f689-49ea-bc7a-d17bab16b364', 'revision': 0, 'last_node_id': 289, 'last_link_id': 587, ...}
|
|
scope = ''
|
|
|
|
def inspect(graph: dict, scope: str = "") -> None:
|
|
is_ui = isinstance(graph.get("nodes"), list)
|
|
nodes = (
|
|
graph["nodes"]
|
|
if is_ui
|
|
else [
|
|
dict(v, id=k, type=v.get("class_type"))
|
|
for k, v in graph.items()
|
|
if isinstance(v, dict) and "class_type" in v
|
|
]
|
|
)
|
|
for node in nodes:
|
|
nid = scope + str(node.get("id", ""))
|
|
ct = node.get("type", "")
|
|
values = node.get("widgets_values", []) if is_ui else node.get("inputs", {})
|
|
inventory.append(
|
|
{
|
|
"node_id": nid,
|
|
"class_type": ct,
|
|
"title": node.get("title") or (node.get("_meta") or {}).get("title"),
|
|
"mode": node.get("mode", 0),
|
|
"source_values": values,
|
|
"inputs": node.get("inputs", []) if is_ui else values,
|
|
}
|
|
)
|
|
if ct in ("Note", "MarkdownNote"):
|
|
notes.append({"node_id": nid, "content": values})
|
|
# Only API/named fields have a defensible node+field association.
|
|
if isinstance(values, dict):
|
|
declared = {
|
|
**info.get(ct, {}).get("input", {}).get("required", {}),
|
|
**info.get(ct, {}).get("input", {}).get("optional", {}),
|
|
}
|
|
for name, value in values.items():
|
|
if is_ui and name == "videopreview":
|
|
# Editor preview metadata is preserved in source_nodes only.
|
|
continue
|
|
if not is_ui and isinstance(value, list) and len(value) == 2:
|
|
links.append(
|
|
{
|
|
"scope": scope,
|
|
"node_id": nid,
|
|
"field": name,
|
|
"upstream_node_id": str(value[0]),
|
|
"output_slot": value[1],
|
|
}
|
|
)
|
|
continue
|
|
spec = declared.get(name, [])
|
|
cfg = spec[1] if len(spec) > 1 and isinstance(spec[1], dict) else {}
|
|
params.append(
|
|
{
|
|
"name": name,
|
|
"node_id": nid,
|
|
"field": name,
|
|
"type": spec[0]
|
|
if spec and isinstance(spec[0], str)
|
|
else type(value).__name__,
|
|
"default": value,
|
|
"unit": None,
|
|
"min": cfg.get("min"),
|
|
"max": cfg.get("max"),
|
|
"options": spec[0] if spec and isinstance(spec[0], list) else None,
|
|
"range_source": "object_info" if spec else "unverified",
|
|
"default_source": "source_file",
|
|
"value_origin": "ui_named_widget" if is_ui else "api_input",
|
|
"effect": cfg.get("tooltip") or "待节点定义及人工核对",
|
|
"advanced": False,
|
|
}
|
|
)
|
|
links.extend({"scope": scope, "link": link} for link in graph.get("links", []))
|
|
> for sub in (graph.get("definitions") or {}).get("subgraphs", []):
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
E AttributeError: 'str' object has no attribute 'get'
|
|
|
|
calliope-backend/src/calliope/comfyui/library.py:211: AttributeError
|
|
=============================== warnings summary ===============================
|
|
calliope-backend/.venv/lib/python3.12/site-packages/starlette/testclient.py:53
|
|
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-892-8d94b12fc336/workdir/aigc-home/calliope-backend/.venv/lib/python3.12/site-packages/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
|
|
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
|
|
|
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
|
=========================== short test summary info ============================
|
|
FAILED calliope-backend/tests/test_krea_views_fixed_document.py::test_whole_graph_mutations_fail_closed[definitions]
|
|
1 failed, 219 passed, 1 warning in 6.00s
|