Skip to content

Commit b24601e

Browse files
committed
ci(fix[smoke]): register wheel smoke tests for all workspace packages
why: The release workflow runs package_tools smoke for every name from print-packages; sphinx-autodoc-badges and sphinx-autodoc-fastmcp were missing from the CLI, failing the publish job with argparse exit 2. what: - Add smoke runners for autodoc-badges and autodoc-fastmcp - Centralize package targets in _PACKAGE_SMOKE_RUNNERS and derive CLI choices from it - Add smoke_workspace_package_names and a test that matches workspace_packages keys
1 parent 645b0ae commit b24601e

2 files changed

Lines changed: 73 additions & 23 deletions

File tree

scripts/ci/package_tools.py

Lines changed: 66 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,69 @@ def smoke_sphinx_autodoc_api_style(dist_dir: pathlib.Path, version: str) -> None
555555
)
556556

557557

558+
def smoke_sphinx_autodoc_badges(dist_dir: pathlib.Path, version: str) -> None:
559+
"""Verify the autodoc-badges extension installs and imports cleanly."""
560+
with tempfile.TemporaryDirectory() as tmp:
561+
python_path = _create_venv(pathlib.Path(tmp))
562+
_install_into_venv(
563+
python_path,
564+
*_workspace_wheel_requirements(dist_dir),
565+
)
566+
_run_python(
567+
python_path,
568+
(
569+
"import sphinx_autodoc_badges; "
570+
"from sphinx_autodoc_badges import setup; "
571+
"assert callable(setup)"
572+
),
573+
)
574+
575+
576+
def smoke_sphinx_autodoc_fastmcp(dist_dir: pathlib.Path, version: str) -> None:
577+
"""Verify the autodoc-fastmcp extension installs and imports cleanly."""
578+
with tempfile.TemporaryDirectory() as tmp:
579+
python_path = _create_venv(pathlib.Path(tmp))
580+
_install_into_venv(
581+
python_path,
582+
*_workspace_wheel_requirements(dist_dir),
583+
)
584+
_run_python(
585+
python_path,
586+
(
587+
"import sphinx_autodoc_fastmcp; "
588+
"from sphinx_autodoc_fastmcp import setup; "
589+
"assert callable(setup)"
590+
),
591+
)
592+
593+
594+
_PACKAGE_SMOKE_RUNNERS: dict[str, t.Callable[[pathlib.Path, str], None]] = {
595+
"gp-sphinx": smoke_gp_sphinx,
596+
"sphinx-argparse-neo": smoke_sphinx_argparse_neo,
597+
"sphinx-autodoc-api-style": smoke_sphinx_autodoc_api_style,
598+
"sphinx-autodoc-badges": smoke_sphinx_autodoc_badges,
599+
"sphinx-autodoc-docutils": smoke_sphinx_autodoc_docutils,
600+
"sphinx-autodoc-fastmcp": smoke_sphinx_autodoc_fastmcp,
601+
"sphinx-autodoc-pytest-fixtures": smoke_sphinx_autodoc_pytest_fixtures,
602+
"sphinx-autodoc-sphinx": smoke_sphinx_autodoc_sphinx,
603+
"sphinx-fonts": smoke_sphinx_fonts,
604+
"sphinx-gptheme": smoke_sphinx_gptheme,
605+
}
606+
607+
608+
def smoke_workspace_package_names() -> frozenset[str]:
609+
"""Return distribution names that have a wheel smoke test.
610+
611+
Excludes ``root-install``, which does not map to a built wheel.
612+
613+
Returns
614+
-------
615+
frozenset[str]
616+
Keys of :data:`_PACKAGE_SMOKE_RUNNERS`.
617+
"""
618+
return frozenset(_PACKAGE_SMOKE_RUNNERS.keys())
619+
620+
558621
def smoke(
559622
target: str,
560623
*,
@@ -571,21 +634,11 @@ def smoke(
571634
message = "--dist-dir is required for package smoke tests"
572635
raise SystemExit(message)
573636

574-
runners: dict[str, t.Callable[[pathlib.Path, str], None]] = {
575-
"gp-sphinx": smoke_gp_sphinx,
576-
"sphinx-gptheme": smoke_sphinx_gptheme,
577-
"sphinx-fonts": smoke_sphinx_fonts,
578-
"sphinx-argparse-neo": smoke_sphinx_argparse_neo,
579-
"sphinx-autodoc-docutils": smoke_sphinx_autodoc_docutils,
580-
"sphinx-autodoc-sphinx": smoke_sphinx_autodoc_sphinx,
581-
"sphinx-autodoc-pytest-fixtures": smoke_sphinx_autodoc_pytest_fixtures,
582-
"sphinx-autodoc-api-style": smoke_sphinx_autodoc_api_style,
583-
}
584-
if target not in runners:
637+
if target not in _PACKAGE_SMOKE_RUNNERS:
585638
message = f"unknown smoke target: {target}"
586639
raise SystemExit(message)
587640
package = packages[target]
588-
runners[target](dist_dir, package.version)
641+
_PACKAGE_SMOKE_RUNNERS[target](dist_dir, package.version)
589642

590643

591644
def main() -> int:
@@ -603,17 +656,7 @@ def main() -> int:
603656
smoke_parser = subparsers.add_parser("smoke")
604657
smoke_parser.add_argument(
605658
"target",
606-
choices=[
607-
"root-install",
608-
"gp-sphinx",
609-
"sphinx-gptheme",
610-
"sphinx-fonts",
611-
"sphinx-argparse-neo",
612-
"sphinx-autodoc-docutils",
613-
"sphinx-autodoc-sphinx",
614-
"sphinx-autodoc-pytest-fixtures",
615-
"sphinx-autodoc-api-style",
616-
],
659+
choices=["root-install", *sorted(_PACKAGE_SMOKE_RUNNERS.keys())],
617660
)
618661
smoke_parser.add_argument("--dist-dir", type=pathlib.Path)
619662

tests/test_package_tools.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ def test_check_versions_passes_for_repo() -> None:
2121
package_tools.check_versions()
2222

2323

24+
def test_smoke_targets_cover_workspace_packages() -> None:
25+
"""Every publishable package has a smoke runner (release workflow loops all)."""
26+
assert package_tools.smoke_workspace_package_names() == frozenset(
27+
package_tools.workspace_packages().keys(),
28+
)
29+
30+
2431
def test_release_metadata_accepts_repo_tag() -> None:
2532
"""Repo-wide release tags resolve to the shared version."""
2633
assert package_tools.release_metadata("v0.0.1a5") == {"version": "0.0.1a5"}

0 commit comments

Comments
 (0)