test(cli): add direct unit tests for ollama lifecycle helpers#1029
Conversation
Greptile SummaryAdds 14 focused unit tests for the Ollama lifecycle helpers in Confidence Score: 5/5Safe to merge — test-only change with no production code modifications and correct assertions throughout All 14 tests are logically correct against the implementation. No P0/P1 issues found. Remaining findings are minor style suggestions (inline imports, type annotation precision) that do not affect test correctness or CI. No files require special attention Important Files Changed
Reviews (1): Last reviewed commit: "test(cli): add direct unit tests for oll..." | Re-trigger Greptile |
…alls type annotation
|
@muddlebee @rrajan94 @VaibhavUpreti kindly review this as well |
|
@Davidson3556 great work |
Fixes #906
Describe the changes you have made in this PR
Added tests/cli/test_local_llm_ollama_lifecycle.py with 14 direct unit tests covering the lifecycle helpers in app/cli/local_llm/ollama.py:
No real package managers or ollama processes are invoked. All external calls (shutil.which, subprocess.Popen, subprocess.run, time.sleep, httpx, questionary) are monkeypatched.
Demo/Screenshot
All 14 tests pass:
python3 -m pytest tests/cli/test_local_llm_ollama_lifecycle.py -v
PASSED test_is_installed_returns_true_when_ollama_on_path
PASSED test_is_installed_returns_false_when_ollama_not_on_path
PASSED test_start_server_opens_popen_with_ollama_serve
PASSED test_wait_for_server_returns_true_on_first_attempt
PASSED test_wait_for_server_returns_true_after_retries
PASSED test_wait_for_server_returns_false_on_timeout
PASSED test_install_macos_brew_present_user_confirms_succeeds
PASSED test_install_macos_brew_present_user_declines_returns_false
PASSED test_install_macos_brew_absent_returns_false_and_prints_link
PASSED test_install_macos_brew_present_subprocess_fails_returns_false
PASSED test_install_linux_user_confirms_succeeds
PASSED test_install_linux_user_declines_returns_false
PASSED test_install_linux_subprocess_fails_returns_false
PASSED test_install_windows_returns_false
14 passed in 0.13s