Files
gpu-rent/tests/test_manifests.py
T
Leonid Pershin 2ab32a8ab5 Refactor LLM configuration to remove llamacpp support
- Removed references to llamacpp from configuration files, scripts, and documentation, streamlining the LLM setup process to focus solely on Ollama.
- Updated environment variables and paths to eliminate llamacpp-related entries, ensuring clarity in the configuration.
- Adjusted CLI commands and help messages to reflect the removal of llamacpp, enhancing user experience and reducing confusion.
- Revised documentation to provide clear guidance on using Ollama exclusively, including updates to setup instructions and runtime options.
2026-08-21 08:51:36 +03:00

80 lines
2.6 KiB
Python

from pathlib import Path
import pytest
from gpu_rent.errors import ConfigError
from gpu_rent.manifests import parse_extensions, parse_models, repo_matches_runtime
def test_models_skips_version_zero(tmp_path: Path):
path = tmp_path / "models.yaml"
path.write_text(
"checkpoint:\n - version_id: 0\n - version_id: 123\n - url: https://civitai.red/models/1?modelVersionId=9\n",
encoding="utf-8",
)
entries = parse_models(path)
assert len(entries) == 2
assert entries[0].version_id == 123
assert entries[1].url.endswith("9")
def test_extensions_empty_file(tmp_path: Path):
path = tmp_path / "extensions.yaml"
path.write_text("swarmui: []\ncomfy: []\n", encoding="utf-8")
assert parse_extensions(path) == []
def test_extensions_repo(tmp_path: Path):
path = tmp_path / "extensions.yaml"
path.write_text(
"swarmui:\n - url: https://github.com/org/Ext.git\n ref: main\n dir: Ext\n",
encoding="utf-8",
)
repos = parse_extensions(path)
assert repos[0].kind == "swarmui"
assert repos[0].directory == "Ext"
assert repos[0].requires == "none"
def test_extensions_requires_ollama(tmp_path: Path):
path = tmp_path / "extensions.yaml"
path.write_text(
"swarmui:\n"
" - url: https://gitea.example/swarm-assistent.git\n"
" ref: main\n"
" dir: swarm-assistent\n"
" requires: ollama\n"
" - url: https://github.com/org/Always.git\n"
" ref: main\n",
encoding="utf-8",
)
repos = parse_extensions(path)
assert repos[0].requires == "ollama"
assert repos[1].requires == "none"
assert repo_matches_runtime(repos[0], "ollama")
assert not repo_matches_runtime(repos[0], "none")
assert repo_matches_runtime(repos[1], "none")
assert repo_matches_runtime(repos[1], "ollama")
def test_extensions_requires_any_llm(tmp_path: Path):
path = tmp_path / "extensions.yaml"
path.write_text(
"swarmui:\n - url: https://example/x.git\n requires: any-llm\n",
encoding="utf-8",
)
repo = parse_extensions(path)[0]
assert repo.requires == "any-llm"
assert repo_matches_runtime(repo, "ollama")
assert not repo_matches_runtime(repo, "none")
def test_extensions_requires_invalid(tmp_path: Path):
path = tmp_path / "extensions.yaml"
path.write_text(
"swarmui:\n - url: https://example/x.git\n requires: docker\n",
encoding="utf-8",
)
with pytest.raises(ConfigError, match="requires"):
parse_extensions(path)