Files
aigc-home/docs/hel-728/pytest.log
T

443 lines
21 KiB
Plaintext

.................................F...................................... [ 8%]
........................................................................ [ 17%]
........................................................................ [ 25%]
........................................................................ [ 34%]
..................................F..................................... [ 42%]
........F............................................................... [ 51%]
........................................................................ [ 59%]
........................................................................ [ 68%]
...F..........F......................................................... [ 76%]
.........s.............................................................. [ 85%]
........................................................................ [ 93%]
sssss................................................ [100%]
=================================== FAILURES ===================================
________________________ test_comfy_server_info_scoping ________________________
def test_comfy_server_info_scoping():
"""Native health check stays visible in both blind and linked sessions."""
from calliope.agent.harness import tools as harness_tools
blind = ToolContext(session_id=1, project_id=None)
linked = ToolContext(session_id=1, project_id=99)
> blind_names = {e["function"]["name"] for e in harness_tools.openai_tools_payload(blind)}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_agent_comfy_mcp.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/calliope/agent/harness/tools.py:27: in openai_tools_payload
return _registry.openai_payload(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/calliope/agent/harness/registry.py:219: in openai_payload
if self._visible(t, ctx)
^^^^^^^^^^^^^^^^^^^^^
src/calliope/agent/harness/registry.py:203: in _visible
if not user_allows_render(ctx):
^^^^^^^^^^^^^^^^^^^^^^^
src/calliope/agent/harness/policy.py:156: in user_allows_render
if has_structured_approval(ctx, "render"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/calliope/agent/harness/policy.py:277: in has_structured_approval
answer = latest_answer(ctx.session_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/calliope/agent/harness/policy.py:260: in latest_answer
events = read_events(session_id)
^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
session_id = 1
def read_events(session_id: int) -> list[SessionEvent]:
conn = _db()
try:
> rows = conn.execute(
"SELECT * FROM agent_events WHERE session_id = ? ORDER BY seq", (session_id,)
).fetchall()
E sqlite3.OperationalError: no such table: agent_events
src/calliope/agent/harness/log.py:146: OperationalError
___________ test_h3_messages_bind_neighbor_shots_and_keep_file_slots ___________
def test_h3_messages_bind_neighbor_shots_and_keep_file_slots():
from calliope.agent.prompts import build_minimax_h3_ref_messages
from calliope.agent.video_agent import resolve_h3_references
from calliope.comfyui.parser import parse_dynamic_inputs
plan = {
"overview": {"style": "noir", "lighting": "sodium"},
"requirements": {"lighting": "sodium lamps only"},
"shots": [
{
"clip_id": 1,
"window": "00:00.000-00:04.000",
"action": "enter",
"camera": "push in",
"lighting": "dim sodium",
"speakers": "MAYA: hello",
"spatial": "screen left",
"state_after": "door open",
},
{
"clip_id": 2,
"window": "00:04.000-00:08.000",
"action": "turn",
"camera": "hold",
"lighting": "dim sodium",
"speakers": "",
"spatial": "screen left",
"state_after": "",
},
{
"clip_id": 3,
"window": "00:08.000-00:12.000",
"action": "leave",
"camera": "pull out",
"lighting": "brighter",
"speakers": "",
"spatial": "",
"state_after": "hallway empty",
},
],
}
lock = continuity_lock_text(plan, 2)
assert "Previous shot" in lock
assert "Next shot" in lock
assert "Do not recast a subject" in lock
assert "screen direction" in lock
assert "enter" in lock and "leave" in lock
scene = {"heading": "INT. HALL", "action": "She turns.", "duration_sec": 4, "dialog": ""}
subjects = [
{
"index": 1,
"kind": "reference",
"name": "mercs",
"appearance": "",
"path": r"E:\assets\mercs.png",
}
]
messages = build_minimax_h3_ref_messages(scene, subjects, continuity=lock)
text = messages[1]["content"]
assert "Previous shot" in text
assert "Next shot" in text
assert "screen direction" in text
assert "do not substitute another character or location" in text
workflow = {
"148": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 1 (Input:image)"},
},
"149": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 2 (Input:image)"},
},
}
inputs = parse_dynamic_inputs(workflow)
resolved, paths, _videos = resolve_h3_references(
inputs,
{"148": r"E:\assets\hero.png", "149": r"E:\assets\mercs.png"},
[{"name": "Maya", "appearance": "olive jacket", "sheet_path": r"E:\assets\maya.png"}],
{"name": "Metro Line", "description": "rain-slick rooftops"},
r"E:\assets\metro.png",
)
> assert resolved[1]["name"] == "mercs"
E AssertionError: assert 'E:\\assets\\mercs' == 'mercs'
E
E - mercs
E + E:\assets\mercs
tests/test_continuity.py:249: AssertionError
___________ test_resolve_h3_references_prefers_form_files_over_story ___________
def test_resolve_h3_references_prefers_form_files_over_story():
"""Slot files the user picked replace the story cast; empty slots keep it."""
from calliope.agent.video_agent import resolve_h3_references
from calliope.comfyui.parser import parse_dynamic_inputs
workflow = {
"148": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 1 (Input:image)"},
},
"149": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 2 (Input:image)"},
},
"150": {
"class_type": "LoadVideo",
"inputs": {"video": ""},
"_meta": {"title": "Motion (Input:video)"},
},
}
inputs = parse_dynamic_inputs(workflow)
characters = [
{
"name": "Maya",
"appearance": "olive jacket",
"sheet_path": r"E:\assets\maya.png",
}
]
location = {"name": "Metro Line", "description": "rain-slick rooftops"}
loc_image = r"E:\assets\metro.png"
empty_subjects, empty_paths, empty_videos = resolve_h3_references(
inputs, {}, characters, location, loc_image
)
assert [s["name"] for s in empty_subjects] == ["Maya", "Metro Line"]
assert empty_paths == [r"E:\assets\maya.png", r"E:\assets\metro.png"]
assert empty_videos == []
subjects, paths, videos = resolve_h3_references(
inputs,
{
"148": r"E:\assets\maya.png",
"149": r"E:\assets\mercs.png",
"150": r"E:\assets\fight.mp4",
},
characters,
location,
loc_image,
)
assert subjects[0]["kind"] == "character"
assert subjects[0]["name"] == "Maya"
assert subjects[1]["kind"] == "reference"
> assert subjects[1]["name"] == "mercs"
E AssertionError: assert 'E:\\assets\\mercs' == 'mercs'
E
E - mercs
E + E:\assets\mercs
tests/test_h3_profile.py:215: AssertionError
___________ test_preview_prompt_uses_form_references_not_story_cast ____________
client = <starlette.testclient.TestClient object at 0x7ff7be3182c0>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ff7bc9b2180>
def test_preview_prompt_uses_form_references_not_story_cast(client, monkeypatch):
"""The Video-tab image and video slots are the prompt's subjects.
Story character + location text must not replace files the user picked,
and Regenerate (force) must not return a draft written before those files.
"""
pid = _mk_project(client, "Preview refs")
scene = _add_scene(client, pid, 1, action="She swings the extinguisher.")
clip_id = _scene_default_clip(pid, scene["id"])
wf = {
"10": {
"class_type": "CLIPTextEncode",
"inputs": {"text": ""},
"_meta": {"title": "Main Prompt (Input:prompt)"},
},
"148": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 1 (Input:image)"},
},
"149": {
"class_type": "LoadImage",
"inputs": {"image": ""},
"_meta": {"title": "Ref 2 (Input:image)"},
},
"150": {
"class_type": "LoadVideo",
"inputs": {"video": ""},
"_meta": {"title": "Motion (Input:video)"},
},
}
conn = get_db(settings.db_path)
try:
cur = conn.execute(
"""
INSERT INTO workflows (name, kind, workflow_json, input_schema, output_schema,
prompt_profile, is_enabled)
VALUES (?, 'video', ?, '[]', '[]', 'minimax_h3_ref', 1)
""",
("H3 refs", json.dumps(wf)),
)
wf_id = cur.lastrowid
char = conn.execute(
"""
INSERT INTO characters (project_id, name, appearance, sheet_path)
VALUES (?, 'Maya', 'olive jacket', ?)
""",
(pid, r"E:\story\maya-sheet.png"),
)
conn.execute(
"INSERT INTO scene_characters (scene_id, character_id) VALUES (?, ?)",
(scene["id"], char.lastrowid),
)
loc = conn.execute(
"""
INSERT INTO locations (project_id, name, description, reference_image_path)
VALUES (?, 'Metro Line', 'rain-slick rooftops', ?)
""",
(pid, r"E:\story\metro.png"),
)
conn.execute(
"UPDATE scenes SET location_id = ? WHERE id = ?",
(loc.lastrowid, scene["id"]),
)
conn.execute(
"UPDATE clips SET workflow_id = ? WHERE id = ?", (wf_id, clip_id)
)
conn.commit()
finally:
conn.close()
seen: dict = {}
async def fake_rewrite(scene_, subjects, **kwargs):
seen["subjects"] = subjects
seen["videos"] = kwargs.get("videos")
seen["calls"] = seen.get("calls", 0) + 1
return "REWRITE FROM REFS"
monkeypatch.setattr("calliope.agent.video_agent._h3_rewrite", fake_rewrite)
form = {
"148": r"E:\refs\hero.png",
"149": r"E:\refs\mercs.png",
"150": r"E:\refs\fight.mp4",
}
r = client.post(
f"/api/jobs/projects/{pid}/preview-prompt",
json={"clip_id": clip_id, "input_values": form},
)
assert r.status_code == 200
body = r.json()
assert body["prompt"] == "REWRITE FROM REFS"
assert body["from_draft"] is False
names = [s["name"] for s in seen["subjects"]]
> assert names == ["hero", "mercs"]
E AssertionError: assert ['E:\\refs\\h...\refs\\mercs'] == ['hero', 'mercs']
E
E At index 0 diff: 'E:\\refs\\hero' != 'hero'
E Use -v to get more diff
tests/test_scene_settings.py:487: AssertionError
---------------------------- Captured stderr setup -----------------------------
2026-10-21 19:58:18,478 | INFO | calliope | Calliope started — db=/tmp/multica-task-3084682389/tmp_95dfjk4/calliope.db dry_run=True
2026-10-21 19:58:18,478 | INFO | calliope.worker | Queue worker started
------------------------------ Captured log setup ------------------------------
INFO calliope:main.py:112 Calliope started — db=/tmp/multica-task-3084682389/tmp_95dfjk4/calliope.db dry_run=True
INFO calliope.worker:worker.py:79 Queue worker started
----------------------------- Captured stderr call -----------------------------
2026-10-21 19:58:18,482 | INFO | httpx2 | HTTP Request: POST http://testserver/api/projects "HTTP/1.1 200 OK"
2026-10-21 19:58:18,495 | INFO | httpx2 | HTTP Request: POST http://testserver/api/projects/1/scenes "HTTP/1.1 200 OK"
2026-10-21 19:58:18,506 | INFO | httpx2 | HTTP Request: POST http://testserver/api/jobs/projects/1/preview-prompt "HTTP/1.1 200 OK"
------------------------------ Captured log call -------------------------------
INFO httpx2:_client.py:1085 HTTP Request: POST http://testserver/api/projects "HTTP/1.1 200 OK"
INFO httpx2:_client.py:1085 HTTP Request: POST http://testserver/api/projects/1/scenes "HTTP/1.1 200 OK"
INFO httpx2:_client.py:1085 HTTP Request: POST http://testserver/api/jobs/projects/1/preview-prompt "HTTP/1.1 200 OK"
--------------------------- Captured stderr teardown ---------------------------
2026-10-21 19:58:18,980 | INFO | calliope.worker | Queue worker stopped
2026-10-21 19:58:18,980 | INFO | calliope | Calliope shutting down
---------------------------- Captured log teardown -----------------------------
INFO calliope.worker:worker.py:185 Queue worker stopped
INFO calliope:main.py:118 Calliope shutting down
_________________ test_script_regenerate_keeps_expanded_count __________________
client = <starlette.testclient.TestClient object at 0x7ff7bd902660>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7ff7bc9b2180>
def test_script_regenerate_keeps_expanded_count(client, monkeypatch):
calls: list[int] = []
async def fake_structured(messages, temperature=0.7):
user = messages[1]["content"]
# Parse required count from prompt
n = 4
for line in user.splitlines():
if line.startswith("required_scene_count:"):
n = int(line.split(":", 1)[1].strip())
break
calls.append(n)
return {
"scenes": [
{
"order_index": i,
"heading": f"SCENE {i}",
"action": f"action {i}",
"dialog": "",
"duration_sec": 5,
"character_ids": [],
"location_id": None,
}
for i in range(1, n + 1)
]
}
monkeypatch.setattr("calliope.agent.script_agent.generate_structured", fake_structured)
r = client.post("/api/projects", json={"title": "Expand", "idea": "desert", "target_duration": "30 seconds"})
pid = r.json()["id"]
# Seed 4 scenes via generate
r = client.post(f"/api/projects/{pid}/generate-script", json={"replace": True})
> assert r.status_code == 200
E assert 500 == 200
E + where 500 = <Response [500 Internal Server Error]>.status_code
tests/test_script_scene_count.py:59: AssertionError
---------------------------- Captured stderr setup -----------------------------
2026-10-21 19:58:19,584 | INFO | calliope | Calliope started — db=/tmp/multica-task-3084682389/tmpl0t0r_mx/calliope.db dry_run=True
2026-10-21 19:58:19,584 | INFO | calliope.worker | Queue worker started
------------------------------ Captured log setup ------------------------------
INFO calliope:main.py:112 Calliope started — db=/tmp/multica-task-3084682389/tmpl0t0r_mx/calliope.db dry_run=True
INFO calliope.worker:worker.py:79 Queue worker started
----------------------------- Captured stderr call -----------------------------
2026-10-21 19:58:19,588 | INFO | httpx2 | HTTP Request: POST http://testserver/api/projects "HTTP/1.1 200 OK"
2026-10-21 19:58:19,604 | INFO | calliope.llm | LLM stream request to http://127.0.0.1:11434/v1/chat/completions with model llama3.2
2026-10-21 19:58:19,606 | INFO | httpx2 | HTTP Request: POST http://testserver/api/projects/1/generate-script "HTTP/1.1 500 Internal Server Error"
------------------------------ Captured log call -------------------------------
INFO httpx2:_client.py:1085 HTTP Request: POST http://testserver/api/projects "HTTP/1.1 200 OK"
INFO calliope.llm:llm.py:360 LLM stream request to http://127.0.0.1:11434/v1/chat/completions with model llama3.2
INFO httpx2:_client.py:1085 HTTP Request: POST http://testserver/api/projects/1/generate-script "HTTP/1.1 500 Internal Server Error"
--------------------------- Captured stderr teardown ---------------------------
2026-10-21 19:58:20,086 | INFO | calliope.worker | Queue worker stopped
2026-10-21 19:58:20,086 | INFO | calliope | Calliope shutting down
---------------------------- Captured log teardown -----------------------------
INFO calliope.worker:worker.py:185 Queue worker stopped
INFO calliope:main.py:118 Calliope shutting down
=============================== warnings summary ===============================
.venv/lib/python3.12/site-packages/starlette/testclient.py:53
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-728-a07b128af8f7/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]]
tests/test_shell_tool.py::test_settings_roundtrip_for_new_keys
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-728-a07b128af8f7/workdir/aigc-home/calliope-backend/.venv/lib/python3.12/site-packages/_pytest/unraisableexception.py:67: PytestUnraisableExceptionWarning: Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x7ff7c055cb80>
Traceback (most recent call last):
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
self.close()
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
proto.pipe.close()
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/unix_events.py", line 568, in close
self._close(None)
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/unix_events.py", line 592, in _close
self._loop.call_soon(self._call_connection_lost, exc)
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 799, in call_soon
self._check_closed()
File "/home/xiaomo/.local/share/uv/python/cpython-3.12.14-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 545, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_agent_comfy_mcp.py::test_comfy_server_info_scoping - sqlite...
FAILED tests/test_continuity.py::test_h3_messages_bind_neighbor_shots_and_keep_file_slots
FAILED tests/test_h3_profile.py::test_resolve_h3_references_prefers_form_files_over_story
FAILED tests/test_scene_settings.py::test_preview_prompt_uses_form_references_not_story_cast
FAILED tests/test_script_scene_count.py::test_script_regenerate_keeps_expanded_count
5 failed, 834 passed, 6 skipped, 2 warnings in 368.55s (0:06:08)