test(wheel): probe all 5 console aliases and bundled defaults#50
Conversation
Extends the wheel smoke test to assert all five console_scripts entries (interlocks, ilocks, ilock, ils, il) are present and executable after install — previously only `interlocks` and `il` were checked. Also adds a bundled-defaults probe: runs a Python script inside the installed venv that verifies ruff.toml, coveragerc, pyrightconfig.json, and importlinter_template.ini are reachable via interlocks.defaults_path (importlib.resources), confirming they ship in the wheel.
There was a problem hiding this comment.
Code Review
This pull request enhances the wheel installation tests by expanding the verification of entry point aliases and ensuring that bundled configuration files are correctly included and resolvable at runtime. The reviewer suggested improving maintainability by dynamically loading the list of aliases from pyproject.toml and the list of bundled configuration files from TOOL_CONFIG_SPECS to avoid hardcoding and potential desynchronization.
| venv_python = venv / "bin" / "python" | ||
| run(["uv", "pip", "install", wheel, "--python", venv_python]) | ||
|
|
||
| all_aliases = ("interlocks", "ilocks", "ilock", "ils", "il") |
There was a problem hiding this comment.
The list of aliases is already defined in pyproject.toml. To avoid duplication and ensure the test stays in sync with the package definition, you can load them dynamically from the project metadata.
pyproject_data = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
all_aliases = tuple(pyproject_data["project"]["scripts"].keys())| bundled_probe = "\n".join([ | ||
| "from interlocks.defaults_path import path", | ||
| *[ | ||
| f"assert path({n!r}).is_file(), f'bundled default missing: {n}'" | ||
| for n in ("ruff.toml", "coveragerc", "pyrightconfig.json", "importlinter_template.ini") | ||
| ], | ||
| ]) |
There was a problem hiding this comment.
Instead of hardcoding the list of bundled configuration files, you can derive them dynamically from TOOL_CONFIG_SPECS. This ensures that any new tools added to the package are automatically covered by this wheel installation test, improving maintainability and reducing duplication. Note that mutmut.toml is mentioned in the pyproject.toml comments as a bundled file but is currently missing from both TOOL_CONFIG_SPECS and this test probe.
bundled_probe = "\n".join([
"from interlocks.defaults_path import path, TOOL_CONFIG_SPECS",
"for spec in TOOL_CONFIG_SPECS.values():",
" assert path(spec.filename).is_file(), f'bundled default missing: {spec.filename}'",
])Load console-script aliases from pyproject.toml [project.scripts] and iterate TOOL_CONFIG_SPECS for bundled-config assertions, so both lists stay in sync with their canonical sources automatically. Addresses review feedback from gemini-code-assist.
Summary
tests/test_wheel_install.pyto check all 5[project.scripts]aliases (interlocks,ilocks,ilock,ils,il) are present and executable after wheel install — previously onlyinterlocksandilwere checked.ruff.toml,coveragerc,pyrightconfig.json, andimportlinter_template.iniare resolvable viainterlocks.defaults_path(importlib.resources), confirming they ship in the wheel.Test plan
uv run pytest -q tests/test_wheel_install.py— 1 passeduvx ruff check tests/test_wheel_install.py— all clear