示例工程 28-packaging-distribution

28-packaging-distribution/02-entry-point-cli/test_entry_point_cli.py

python · 0.5 KB

"""test_entry_point_cli.py"""
 
from __future__ import annotations
 
import pytest
from entry_point_cli import main, run_entry, uv_available
 
pytestmark = pytest.mark.skipif(not uv_available(), reason="需要 uv")
 
 
def test_entry_function_runs_from_wheel() -> None:
    assert run_entry() == "hello from entry point"
 
 
def test_main_runs(capsys: pytest.CaptureFixture[str]) -> None:
    main()
    out = capsys.readouterr().out
    assert "entry output: hello from entry point" in out