tenseleyflow/sway / 979221f

Browse files

tests/mlx_convert: pytest.importorskip safetensors so fast lane (no [hf]) skips cleanly

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
979221fc059916189fea35c787161b057ca4405c
Parents
2c9df2f
Tree
658f625

1 changed file

StatusFile+-
M tests/unit/test_mlx_convert.py 11 2
tests/unit/test_mlx_convert.pymodified
@@ -18,9 +18,18 @@ from pathlib import Path
1818
 
1919
 import numpy as np
2020
 import pytest
21
-from safetensors.numpy import load_file, save_file
2221
 
23
-from dlm_sway.backends._mlx_convert import (
22
+# safetensors ships in the [hf] extra (not [dev]). The fast lane runs
23
+# without [hf]; skip the whole module when missing rather than fail
24
+# collection. Local + slow-lane runs install [hf] and exercise these.
25
+safetensors_numpy = pytest.importorskip(
26
+    "safetensors.numpy",
27
+    reason="safetensors not installed (install via the [hf] extra)",
28
+)
29
+load_file = safetensors_numpy.load_file
30
+save_file = safetensors_numpy.save_file
31
+
32
+from dlm_sway.backends._mlx_convert import (  # noqa: E402 — import-after-skip
2433
     MlxConvertError,
2534
     _extract_layer_index,
2635
     _strip_layer_prefix,