Prepare CmdForge 0.2.0 for PyPI
This commit is contained in:
+46
-4
@@ -1,5 +1,6 @@
|
||||
"""Tests for packaging metadata."""
|
||||
"""Release metadata checks for the public Python distribution."""
|
||||
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
@@ -9,12 +10,53 @@ if sys.version_info >= (3, 11):
|
||||
else:
|
||||
tomllib = pytest.importorskip("tomli")
|
||||
|
||||
from cmdforge import __version__
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _project_metadata() -> dict:
|
||||
with (ROOT / "pyproject.toml").open("rb") as handle:
|
||||
return tomllib.load(handle)["project"]
|
||||
|
||||
|
||||
def test_runtime_and_distribution_versions_match():
|
||||
assert _project_metadata()["version"] == __version__
|
||||
|
||||
|
||||
def test_public_distribution_metadata_is_complete():
|
||||
project = _project_metadata()
|
||||
|
||||
assert project["name"] == "cmdforge"
|
||||
assert project["readme"] == "PYPI_README.md"
|
||||
assert project["license"] == "MIT"
|
||||
assert project["license-files"] == ["LICENSE"]
|
||||
assert project["requires-python"] == ">=3.10"
|
||||
assert {"Homepage", "Documentation", "Repository", "Issues", "Changelog"} <= set(
|
||||
project["urls"]
|
||||
)
|
||||
|
||||
|
||||
def test_public_readme_describes_installation_and_current_capabilities():
|
||||
readme = (ROOT / "PYPI_README.md").read_text(encoding="utf-8")
|
||||
|
||||
for term in (
|
||||
'pipx install "cmdforge[mcp,pty]"',
|
||||
"cmdforge providers discover",
|
||||
"cmdforge mcp configure codex",
|
||||
"--no-fallback",
|
||||
"--result-envelope json",
|
||||
):
|
||||
assert term in readme
|
||||
|
||||
assert (ROOT / "LICENSE").is_file()
|
||||
|
||||
|
||||
def test_web_templates_and_static_are_declared_as_package_data():
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
with (ROOT / "pyproject.toml").open("rb") as handle:
|
||||
data = tomllib.load(handle)
|
||||
|
||||
package_data = data["tool"]["setuptools"]["package-data"]["cmdforge.web"]
|
||||
|
||||
assert "templates/**/*.html" in package_data
|
||||
assert "static/**/*" in package_data
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
"""Behavioral coverage for registry-aware picker and deprecation UX."""
|
||||
|
||||
from io import StringIO
|
||||
import sys
|
||||
import time
|
||||
from unittest.mock import patch
|
||||
|
||||
import cmdforge.cli.picker as picker
|
||||
import pytest
|
||||
from cmdforge import __version__
|
||||
from cmdforge.cli.picker import PickerResult
|
||||
|
||||
|
||||
@@ -89,3 +92,19 @@ def test_local_deprecation_selection_prints_migration_guidance():
|
||||
output = picker._ui_out.getvalue()
|
||||
assert "Moved." in output
|
||||
assert "official/new" in output
|
||||
|
||||
|
||||
def test_picker_help_does_not_require_a_terminal(capsys):
|
||||
with patch.object(sys, "argv", ["cf", "--help"]), pytest.raises(SystemExit) as exc:
|
||||
picker.main()
|
||||
|
||||
assert exc.value.code == 0
|
||||
assert "Interactively find and run" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_picker_version_does_not_require_a_terminal(capsys):
|
||||
with patch.object(sys, "argv", ["cf", "--version"]), pytest.raises(SystemExit) as exc:
|
||||
picker.main()
|
||||
|
||||
assert exc.value.code == 0
|
||||
assert f"cf {__version__}" in capsys.readouterr().out
|
||||
|
||||
@@ -118,7 +118,7 @@ def test_installation_matches_runtime_and_current_provider_onboarding():
|
||||
|
||||
assert "Python 3.10" in installation
|
||||
assert "Python 3.8" not in installation
|
||||
assert "cmdforge[mcp]" in installation
|
||||
assert "cmdforge[mcp,pty]" in installation
|
||||
assert "cmdforge providers discover --add" in installation
|
||||
assert "cmdforge providers discover --add" in provider_setup
|
||||
assert "--type api" in provider_setup
|
||||
|
||||
Reference in New Issue
Block a user