Files
OpenJarvis/tests/core/test_config_phase3.py
T
Jon Saad-FalconandClaude Opus 4.6 323d7ff032 Add TOML config system for eval suites, pillar-aligned config, and documentation
- Eval config: TOML-based suite configs defining models x benchmarks matrix,
  loaded via --config flag. Includes load_eval_config(), expand_suite(),
  7 config dataclasses, 3 example configs, and 61 new tests.
- Pillar-aligned config: generation params in IntelligenceConfig, nested
  engine/learning configs, agent objective/system_prompt/context_from_memory,
  structured learning sub-policies, TOML migration layer.
- Documentation: evaluations user guide, evals API reference, updated
  mkdocs.yml navigation, updated architecture docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 03:34:05 +00:00

79 lines
2.4 KiB
Python

"""Tests for Phase 3 config additions (AgentConfig expansion, ServerConfig)."""
from __future__ import annotations
from openjarvis.core.config import (
AgentConfig,
HardwareInfo,
JarvisConfig,
ServerConfig,
generate_default_toml,
)
class TestAgentConfig:
def test_defaults(self):
cfg = AgentConfig()
assert cfg.default_agent == "simple"
assert cfg.max_turns == 10
assert cfg.tools == ""
assert cfg.default_tools == "" # backward-compat property
assert cfg.objective == ""
assert cfg.system_prompt == ""
assert cfg.system_prompt_path == ""
assert cfg.context_from_memory is True
def test_custom_values(self):
cfg = AgentConfig(
default_agent="orchestrator",
max_turns=5,
tools="calculator,think",
)
assert cfg.default_agent == "orchestrator"
assert cfg.tools == "calculator,think"
assert cfg.default_tools == "calculator,think" # backward-compat
class TestServerConfig:
def test_defaults(self):
cfg = ServerConfig()
assert cfg.host == "0.0.0.0"
assert cfg.port == 8000
assert cfg.agent == "orchestrator"
assert cfg.model == ""
assert cfg.workers == 1
def test_custom_values(self):
cfg = ServerConfig(host="127.0.0.1", port=9000, agent="simple")
assert cfg.host == "127.0.0.1"
assert cfg.port == 9000
class TestJarvisConfig:
def test_has_server(self):
cfg = JarvisConfig()
assert hasattr(cfg, "server")
assert isinstance(cfg.server, ServerConfig)
def test_agent_config_expanded(self):
cfg = JarvisConfig()
assert hasattr(cfg.agent, "default_tools") # backward-compat property
assert hasattr(cfg.agent, "tools")
assert hasattr(cfg.agent, "objective")
assert hasattr(cfg.agent, "system_prompt")
assert hasattr(cfg.agent, "context_from_memory")
class TestGenerateDefaultToml:
def test_includes_server_section(self):
hw = HardwareInfo(cpu_brand="Test CPU", cpu_count=4, ram_gb=16.0)
toml_str = generate_default_toml(hw)
assert "[server]" in toml_str
assert "port = 8000" in toml_str
def test_includes_agent_section(self):
hw = HardwareInfo()
toml_str = generate_default_toml(hw)
assert "[agent]" in toml_str
assert "default_agent" in toml_str