Files
OpenJarvis/tests/cli/test_init_guidance.py
T
Jon Saad-FalconandClaude Opus 4.6 24972e3e52 Add Phase 12+13: energy measurement, install polish, PWA, cross-hardware
Phase 12 — Energy Measurement Upgrade:
- EnergyMonitor ABC with multi-vendor support (NVIDIA hw counters,
  AMD amdsmi, Apple zeus-ml, CPU RAPL sysfs)
- EnergyBatch batch-level energy-per-token accounting
- SteadyStateDetector CV-based thermal equilibrium detection
- EnergyBenchmark with warmup phase
- InstrumentedEngine prefers EnergyMonitor over legacy GpuMonitor
- Telemetry store/aggregator extended with energy fields

Phase 13 — Install, Hosting, Cross-Hardware:
- jarvis doctor diagnostic command (8 checks, --json output)
- jarvis init post-setup guidance with engine-specific next steps
- README Quick Start section
- MLX engine backend (Apple Silicon → mlx recommendation)
- AMD VRAM/multi-GPU detection via rocm-smi
- PyTorch MPS device selection in orchestrator trainers
- PWA support (vite-plugin-pwa, service worker, manifest, icons)
- Server static file serving fix for PWA files
- Dockerfile.gpu.rocm + docker-compose.gpu.rocm.yml for ROCm
- Eval framework display module and efficiency metrics

2244 tests pass, 37 skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:09:07 +00:00

69 lines
2.1 KiB
Python

"""Tests for ``jarvis init`` next-steps guidance."""
from __future__ import annotations
from pathlib import Path
from unittest import mock
from click.testing import CliRunner
from openjarvis.cli import cli
from openjarvis.cli.init_cmd import _next_steps_text
class TestInitShowsNextSteps:
def test_init_shows_next_steps(self, tmp_path: Path) -> None:
"""Init command prints next-steps panel after writing config."""
config_dir = tmp_path / ".openjarvis"
config_path = config_dir / "config.toml"
with (
mock.patch(
"openjarvis.cli.init_cmd.DEFAULT_CONFIG_DIR", config_dir
),
mock.patch(
"openjarvis.cli.init_cmd.DEFAULT_CONFIG_PATH", config_path
),
):
result = CliRunner().invoke(cli, ["init"])
assert result.exit_code == 0
assert "Getting Started" in result.output
assert "jarvis ask" in result.output
assert "jarvis doctor" in result.output
class TestNextStepsOllama:
def test_next_steps_ollama(self) -> None:
text = _next_steps_text("ollama")
assert "ollama.com/install.sh" in text
assert "ollama serve" in text
assert "ollama pull" in text
assert "jarvis ask" in text
assert "jarvis doctor" in text
class TestNextStepsVllm:
def test_next_steps_vllm(self) -> None:
text = _next_steps_text("vllm")
assert "pip install vllm" in text
assert "vllm serve" in text
assert "jarvis ask" in text
assert "jarvis doctor" in text
class TestNextStepsLlamacpp:
def test_next_steps_llamacpp(self) -> None:
text = _next_steps_text("llamacpp")
assert "llama.cpp" in text
assert "llama-server" in text
assert "jarvis ask" in text
assert "jarvis doctor" in text
class TestNextStepsMlx:
def test_next_steps_mlx(self) -> None:
text = _next_steps_text("mlx")
assert "mlx-lm" in text
assert "mlx_lm.server" in text
assert "jarvis ask" in text
assert "jarvis doctor" in text