56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from agentci.config import Settings
|
|
|
|
|
|
def test_parses_comma_delimited_install_scripts() -> None:
|
|
settings = Settings(
|
|
_env_file=None, # type: ignore[call-arg]
|
|
install_scripts=" python, dotnet, company-tools, ",
|
|
)
|
|
|
|
assert settings.install_scripts == ["python", "dotnet", "company-tools"]
|
|
|
|
|
|
@pytest.mark.parametrize("value", ["../script", "tools/setup", "python,python"])
|
|
def test_rejects_unsafe_or_duplicate_install_scripts(value: str) -> None:
|
|
with pytest.raises(ValidationError):
|
|
Settings(_env_file=None, install_scripts=value) # type: ignore[call-arg]
|
|
|
|
|
|
def test_empty_install_scripts_disable_setup() -> None:
|
|
settings = Settings(
|
|
_env_file=None, # type: ignore[call-arg]
|
|
install_scripts="",
|
|
)
|
|
assert settings.install_scripts == []
|
|
|
|
|
|
def test_defaults_research_variant_to_high(monkeypatch) -> None:
|
|
monkeypatch.delenv("AGENTCI_RESEARCH_VARIANT", raising=False)
|
|
settings = Settings(_env_file=None) # type: ignore[call-arg]
|
|
assert settings.research_variant == "high"
|
|
|
|
|
|
def test_defaults_explore_agent_to_luna_low() -> None:
|
|
settings = Settings(_env_file=None) # type: ignore[call-arg]
|
|
assert settings.explore_model == "openai/gpt-5.6-luna"
|
|
assert settings.explore_variant == "low"
|
|
|
|
|
|
def test_reads_comma_delimited_install_scripts_from_environment(monkeypatch) -> None:
|
|
monkeypatch.setenv("AGENTCI_INSTALL_SCRIPTS", "python,dotnet")
|
|
|
|
settings = Settings(_env_file=None) # type: ignore[call-arg]
|
|
|
|
assert settings.install_scripts == ["python", "dotnet"]
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"field", ["plan_model", "implement_model", "explore_model", "research_model"]
|
|
)
|
|
def test_requires_provider_qualified_opencode_models(field: str) -> None:
|
|
with pytest.raises(ValidationError, match="provider/model"):
|
|
Settings(_env_file=None, **{field: "model-only"}) # type: ignore[call-arg]
|