mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-14 16:08:41 +00:00
* test(skills): skip the skill-export capture suite where fd-based walking is unavailable export._capture intentionally rejects every export with 422 skill_export_unsupported on platforms without os.O_NOFOLLOW and dir_fd directory walking (Windows), so the 40 capture-dependent tests in test_skill_export.py and test_gateway_skill_export.py fail there. Add a requires_safe_capture mark mirroring the production feature guard and apply it to those tests; the 21 tests that only exercise the zip installer, export lock, or router plumbing keep running. * test(skills): share requires_safe_capture and cover the blocking-io export suite Move the mirror of export._capture's platform guard into tests/support/skill_export_platform.py so the per-file copies cannot drift, and apply it to blocking_io/test_skill_export.py::test_export_worker_and_response_are_off_loop, which drives the real exporter and hits the same 422 skill_export_unsupported guard on Windows (the blocking-io suite is excluded from the default make test run). --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""The real exporter, compression, response reads and cleanup stay off-loop."""
|
|
|
|
import asyncio
|
|
|
|
import pytest
|
|
from support.skill_export_platform import requires_safe_capture
|
|
|
|
from app.gateway.skill_export import SkillExportResponse, run_export_work
|
|
from deerflow.skills.export import build_skill_export, export_manifest
|
|
from deerflow.skills.storage.local_skill_storage import LocalSkillStorage
|
|
|
|
|
|
@pytest.fixture
|
|
def storage(tmp_path):
|
|
storage = LocalSkillStorage(host_path=str(tmp_path))
|
|
root = storage.get_custom_skill_dir("demo")
|
|
root.mkdir(parents=True)
|
|
(root / "SKILL.md").write_text("---\nname: demo\ndescription: Offline fixture\n---\nbody", encoding="utf-8")
|
|
return storage
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
@requires_safe_capture
|
|
async def test_export_worker_and_response_are_off_loop(storage):
|
|
manifest, lease = await run_export_work(lambda cancel: export_manifest(storage, "demo", cancel))
|
|
lease.release()
|
|
archive, lease = await run_export_work(lambda cancel: build_skill_export(storage, "demo", manifest["revision"], cancel))
|
|
response = SkillExportResponse(archive, "demo", lease)
|
|
sent = []
|
|
|
|
async def send(event):
|
|
sent.append(event)
|
|
|
|
async def receive():
|
|
await asyncio.Event().wait()
|
|
|
|
await response({"type": "http", "asgi": {"spec_version": "2.4"}}, receive, send)
|
|
assert sent[0]["status"] == 200
|
|
assert b"".join(event.get("body", b"") for event in sent).startswith(b"PK")
|
|
assert archive.file.closed
|