mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-06-13 22:34:06 +00:00
fix: preserve uv pip update reinstall semantics
Maintainer edit: the uv fallback for CLI app updates now keeps the force-reinstall behavior from the python -m pip path by using uv pip install --reinstall, with unit coverage for the generated argv.
This commit is contained in:
parent
c2e9064b35
commit
c77ca16d91
@ -723,7 +723,7 @@ class CliAppManager:
|
|||||||
if pip_available:
|
if pip_available:
|
||||||
prefix.extend(["--upgrade", "--force-reinstall"])
|
prefix.extend(["--upgrade", "--force-reinstall"])
|
||||||
else:
|
else:
|
||||||
prefix.append("--upgrade")
|
prefix.extend(["--upgrade", "--reinstall"])
|
||||||
return prefix + args
|
return prefix + args
|
||||||
|
|
||||||
def _pip_uninstall_argv(
|
def _pip_uninstall_argv(
|
||||||
|
|||||||
@ -815,6 +815,34 @@ def test_install_uses_uv_pip_when_pip_unavailable(
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_uses_uv_pip_reinstall_when_pip_unavailable(
|
||||||
|
tmp_path: Path,
|
||||||
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
|
) -> None:
|
||||||
|
manager = _manager(tmp_path)
|
||||||
|
monkeypatch.setattr(CliAppManager, "_pip_available", staticmethod(lambda: False))
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"nanobot.apps.cli.service.shutil.which",
|
||||||
|
lambda command: "/usr/bin/uv" if command == "uv" else None,
|
||||||
|
)
|
||||||
|
|
||||||
|
argv = manager._pip_install_argv(
|
||||||
|
{"name": "gimp", "install_cmd": "pip install cli-anything-gimp"},
|
||||||
|
update=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert argv == [
|
||||||
|
"uv",
|
||||||
|
"pip",
|
||||||
|
"install",
|
||||||
|
"--python",
|
||||||
|
sys.executable,
|
||||||
|
"--upgrade",
|
||||||
|
"--reinstall",
|
||||||
|
"cli-anything-gimp",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_uninstall_uses_uv_pip_when_pip_unavailable(
|
def test_uninstall_uses_uv_pip_when_pip_unavailable(
|
||||||
tmp_path: Path,
|
tmp_path: Path,
|
||||||
monkeypatch: pytest.MonkeyPatch,
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user