From 6d827efb0e39fc90d7d4dc674ee95167783b1406 Mon Sep 17 00:00:00 2001 From: axelray-dev <110029405+axelray-dev@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:32:42 +0800 Subject: [PATCH] test: explicitly stub _pip_available in pip-path tests CI's uv-managed Python does not have pip importable, so the runtime falls back to uv pip. Four tests that verify the python -m pip path were failing because _pip_available() returned False in CI. Monkeypatch _pip_available to True in tests that intentionally verify the pip code path, so they pass regardless of the CI Python environment. --- tests/cli_apps/test_service.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/cli_apps/test_service.py b/tests/cli_apps/test_service.py index 6d07ecbf9..c98f2449b 100644 --- a/tests/cli_apps/test_service.py +++ b/tests/cli_apps/test_service.py @@ -283,6 +283,7 @@ def test_install_dispatches_safe_pip_and_installs_skill( return subprocess.CompletedProcess(argv, 0, stdout="ok", stderr="") monkeypatch.setattr(manager, "_run_argv", fake_run) + monkeypatch.setattr(manager, "_pip_available", staticmethod(lambda: True)) monkeypatch.setattr( manager, "_fetch_skill_content", @@ -572,6 +573,7 @@ def test_uninstall_uses_safe_python_m_pip_uninstall_command( return subprocess.CompletedProcess(argv, 0, stdout="ok", stderr="") monkeypatch.setattr(manager, "_run_argv", fake_run) + monkeypatch.setattr(manager, "_pip_available", staticmethod(lambda: True)) payload = manager.uninstall("suno") @@ -599,6 +601,7 @@ def test_uninstall_uses_recorded_pip_distribution( return subprocess.CompletedProcess(argv, 0, stdout="ok", stderr="") monkeypatch.setattr(manager, "_run_argv", fake_run) + monkeypatch.setattr(manager, "_pip_available", staticmethod(lambda: True)) payload = manager.uninstall("gimp") @@ -621,6 +624,7 @@ def test_uninstall_keeps_state_when_entry_point_still_available( "_run_argv", lambda argv, *, timeout: subprocess.CompletedProcess(argv, 0, stdout="ok", stderr=""), ) + monkeypatch.setattr(manager, "_pip_available", staticmethod(lambda: True)) monkeypatch.setattr( "nanobot.apps.cli.service.shutil.which", lambda command: "/usr/local/bin/cli-anything-gimp" if command == "cli-anything-gimp" else None,