示例工程 32-capstone-publishable-package
32-capstone-publishable-package/01-package-skeleton/test_package_skeleton.py
"""test_package_skeleton.py"""
from __future__ import annotations
import pytest
from package_skeleton import build_and_check, main, uv_available
pytestmark = pytest.mark.skipif(not uv_available(), reason="需要 uv")
def test_wheel_and_public_api() -> None:
facts = build_and_check()
assert str(facts["wheel"]).startswith("capstone_pkg-1.0.0-")
assert facts["core"] is True
assert facts["cli"] is True
assert facts["api"] == "['add', 'main']"
def test_main_runs(capsys: pytest.CaptureFixture[str]) -> None:
main()
out = capsys.readouterr().out
assert "api: ['add', 'main']" in out