deer-flow/backend/tests/support/skill_export_platform.py
Shxiao a06688ad82
test(skills): skip the skill-export capture suite where fd-based walking is unavailable (#5372)
* 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>
2026-09-12 14:32:05 +08:00

18 lines
787 B
Python

"""The platform boundary shared by the skill-export test suites.
``deerflow.skills.export._capture`` feature-detects fd-based directory
walking and otherwise rejects every export with ``422
skill_export_unsupported`` (Windows is the main such platform). Every
suite that drives the real exporter must skip exactly where that guard
fires, and the mirror lives here so the per-file copies cannot drift.
"""
import os
import pytest
requires_safe_capture = pytest.mark.skipif(
not hasattr(os, "O_NOFOLLOW") or os.open not in os.supports_dir_fd or os.scandir not in os.supports_fd,
reason="skill export capture needs os.O_NOFOLLOW and dir_fd directory walking, which this platform does not provide; export_manifest/build_skill_export return 422 skill_export_unsupported there",
)