50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Tests for model_manager.py and environment PATH resolution."""
|
|
|
|
import os
|
|
import shutil
|
|
import tempfile
|
|
from pathlib import Path
|
|
from model_manager import ModelManager, DEFAULT_MODEL
|
|
from env_setup import setup_environment_path
|
|
|
|
def test_environment_path():
|
|
setup_environment_path()
|
|
path_env = os.environ.get("PATH", "")
|
|
assert "/Users/adolforeyna/.local/bin" in path_env or os.path.expanduser("~/.local/bin") in path_env
|
|
paseo_loc = shutil.which("paseo")
|
|
assert paseo_loc is not None, f"Paseo CLI not found on PATH: {path_env}"
|
|
print(f"PASS: setup_environment_path verified (paseo at {paseo_loc})")
|
|
|
|
def test_model_manager():
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
workspace = Path(tmpdir)
|
|
mm = ModelManager(workspace)
|
|
|
|
# Test default
|
|
assert mm._active_model == DEFAULT_MODEL
|
|
|
|
# Test model listing
|
|
models_text = mm.list_available_models()
|
|
assert "Available Models:" in models_text
|
|
assert "Active Model:" in models_text
|
|
|
|
# Test setting alias
|
|
ok, msg = mm.apply_model("hermes")
|
|
assert ok
|
|
assert mm._active_model == "hermes-3"
|
|
|
|
# Test persistence
|
|
saved_file = workspace / "model_settings.json"
|
|
assert saved_file.exists()
|
|
|
|
# Reload in new instance
|
|
mm2 = ModelManager(workspace)
|
|
assert mm2._active_model == "hermes-3"
|
|
print("PASS: test_model_manager verified")
|
|
|
|
if __name__ == "__main__":
|
|
test_environment_path()
|
|
test_model_manager()
|
|
print("\nAll tests passed successfully!")
|