MiniMax-H3-Image-mlx / tests /test_inference_only.py
devin-lai's picture
Prepare inference-only v0.5.0 runtime cleanup
63e9703 verified
Raw History Blame
1.4 kB
import importlib.util
from pathlib import Path
import pytest
from h3_mlx.cli import main
def test_conversion_module_is_not_discoverable():
assert importlib.util.find_spec("h3_mlx.convert") is None
@pytest.mark.parametrize(
"option", ["--quantize", "--encoder-quantize", "--quantized-core"]
)
def test_cli_rejects_conversion_options(option, tmp_path):
with pytest.raises(SystemExit) as error:
main(
[
"generate",
"--model",
str(tmp_path),
"--text-encoder",
str(tmp_path),
"prompt",
option,
"8",
]
)
assert error.value.code == 2
def test_help_works_without_loading_metal(capsys):
with pytest.raises(SystemExit) as error:
main(["--help"])
assert error.value.code == 0
assert "download" in capsys.readouterr().out
def test_release_audit_accepts_public_runtime():
path = Path(__file__).resolve().parents[1] / "tools/check_release.py"
spec = importlib.util.spec_from_file_location("release_audit", path)
audit = importlib.util.module_from_spec(spec)
spec.loader.exec_module(audit)
audit.check_source(path.parents[1])
with pytest.raises(ValueError, match="Conversion operation"):
audit.check_python("bad.py", "import mlx.core as mx\nmx.quantize(weights)")