Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions tests/test_wheel_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ def run(cmd: list[str | Path], *, cwd: Path = tmp_path) -> subprocess.CompletedP
venv_python = venv / "bin" / "python"
run(["uv", "pip", "install", wheel, "--python", venv_python])

pyproject_data = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
all_aliases = tuple(pyproject_data["project"]["scripts"].keys())
for alias in all_aliases:
bin_path = venv / "bin" / alias
assert bin_path.exists(), f"entry point missing: {alias} at {bin_path}"
assert bin_path.stat().st_mode & 0o111, f"entry point not executable: {alias}"

interlocks_bin = venv / "bin" / "interlocks"
il_bin = venv / "bin" / "il"
for bin_path in (interlocks_bin, il_bin):
assert bin_path.exists(), f"entry point missing at {bin_path}"
assert bin_path.stat().st_mode & 0o111, f"entry point not executable at {bin_path}"

help_out = run([interlocks_bin, "help", "--advanced"]).stdout
for expected in ("check", "ci", "pre-commit", "nightly"):
Expand All @@ -71,6 +75,16 @@ def run(cmd: list[str | Path], *, cwd: Path = tmp_path) -> subprocess.CompletedP
for cmd in version_cmds:
assert run(cmd).stdout.strip() == version, cmd

# Verify bundled default configs ship inside the wheel and are resolvable
# via interlocks.defaults_path (importlib.resources) — the runtime mechanism
# used by every tool dispatch that lacks a project-native config.
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}'",
])
Comment on lines +81 to +85

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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}'",
    ])

run([venv_python, "-c", bundled_probe])

setup_project = tmp_path / "setup-project"
setup_project.mkdir()
(setup_project / "pyproject.toml").write_text(
Expand Down
Loading