Files
mlx-knife/tests_2.0/spec/test_cli_version_output.py
The BROKE Cluster Team 86f669dc82 Release 2.0.4-beta.1: Vision + Pipes + Memory
- Vision Support (Issue #45): CLI + Server with OpenAI-compatible image API, EXIF metadata
- Unix Pipes (ADR-014): stdin support, isatty detection, SIGPIPE handling
- Memory-Aware Loading (ADR-016): Pre-load checks with >70% RAM warnings
- Python 3.9-3.14: Full compatibility verified (476-485 tests passing)
- Fixed: --log-json regression (Issue #44), Vision multimodal history filtering

See CHANGELOG.md for complete details.
2025-12-16 19:35:30 +01:00

37 lines
1.2 KiB
Python

import sys
import json
import pytest
@pytest.mark.spec
def test_cli_version_json_output(monkeypatch, capsys):
from mlxk2 import __version__
from mlxk2.spec import JSON_API_SPEC_VERSION
from mlxk2 import cli
monkeypatch.setenv("PYTHONWARNINGS", "ignore")
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
monkeypatch.setattr(sys, "argv", ["mlxk2", "--version", "--json"])
with pytest.raises(SystemExit) as exc:
cli.main()
assert exc.value.code == 0
out = capsys.readouterr().out.strip()
data = json.loads(out)
assert data["status"] == "success"
assert data["command"] == "version"
assert data["error"] is None
assert data["data"]["cli_version"] == __version__
assert data["data"]["json_api_spec_version"] == JSON_API_SPEC_VERSION
# 0.1.6: system object with memory info (macOS only)
system = data["data"].get("system")
assert system is None or isinstance(system, dict), "system must be null or object"
if system is not None:
# On macOS, memory_total_bytes should be present
if "memory_total_bytes" in system:
assert isinstance(system["memory_total_bytes"], int)
assert system["memory_total_bytes"] > 0