hkuds--openharness
4090728163
The Windows PowerShell installer (scripts/install.ps1) hard-coded openh.exe
as the expected binary and printed "Launch (PowerShell): openh" in the
final instructions. The `openh` console-script alias was added in ce84a6a,
which landed after the v0.1.6 tag — so `pip install openharness-ai`
(the default install path) fetches a wheel whose entry_points.txt only
declares `oh`, `ohmo`, and `openharness`. openh.exe is never created, and
users follow the install banner straight into a "not recognized" error
(issue #144).
Instead of requiring a new PyPI release before the installer becomes
correct, detect which launcher the wheel actually produced and guide the
user to it. Preference order: openh (no shell collisions) -> openharness
(no collisions, always present) -> oh (collides with PowerShell's
Out-Host alias unless invoked as oh.exe).
Verification now succeeds against whichever launcher exists, and the
final "Next steps" block recommends the matching command along with the
relevant Out-Host caveat.
Co-authored-by: José Maia <glitch-ux@users.noreply.github.com>
42 行
1.5 KiB
Python
42 行
1.5 KiB
Python
"""Installer regressions for Windows command aliases."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import tomllib
|
|
except ModuleNotFoundError: # pragma: no cover - Python < 3.11
|
|
import tomli as tomllib
|
|
|
|
|
|
def test_pyproject_exposes_openh_console_script():
|
|
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
|
|
scripts = data["project"]["scripts"]
|
|
assert scripts["openh"] == "openharness.cli:app"
|
|
assert scripts["oh"] == "openharness.cli:app"
|
|
|
|
|
|
def test_powershell_installer_recommends_openh_for_windows():
|
|
script = Path("scripts/install.ps1").read_text(encoding="utf-8")
|
|
assert "openh.exe" in script
|
|
assert "Launch (PowerShell): openh" in script
|
|
assert "Out-Host" in script
|
|
|
|
|
|
def test_powershell_installer_falls_back_when_openh_exe_missing():
|
|
"""Older PyPI releases don't ship an `openh` console script.
|
|
|
|
When `openh.exe` is absent from the venv, the installer must still pick a
|
|
working launcher (`openharness` or `oh.exe`) and guide the user to it
|
|
rather than telling them to run a binary that doesn't exist (issue #144).
|
|
"""
|
|
script = Path("scripts/install.ps1").read_text(encoding="utf-8")
|
|
# Every launcher produced by the pyproject `[project.scripts]` table is
|
|
# probed during verification.
|
|
assert "openharness.exe" in script
|
|
assert "oh.exe" in script
|
|
# Fallback guidance for users on a release without the `openh` alias.
|
|
assert "Launch (PowerShell): openharness" in script
|
|
assert "Launch (PowerShell): oh.exe" in script
|