Skip to content

Commit eb45857

Browse files
committed
tests: skip checkpoint tests when transformers is absent
If torch is installed but transformers is not, model loading raises an install-hint error before config.json is read. Both new checkpoint tests would then fail on the filename assertion even though Guard behaves correctly. Guard both with pytest.importorskip('transformers'). Fixes P2 raised in Greptile review.
1 parent 41eb7d0 commit eb45857

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎sdk/tests/unit/ml/test_model_store.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ def test_guard_exposes_truncated_checkpoint_error(
558558
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
559559
) -> None:
560560
pytest.importorskip("torch")
561+
pytest.importorskip("transformers")
561562
monkeypatch.delenv("UNPLUG_MODEL_PATH", raising=False)
562563
ckpt = tmp_path / "truncated"
563564
_write_checkpoint(ckpt, config='{"model_type": "deberta-v2"') # cut off mid-JSON
@@ -580,6 +581,7 @@ def test_guard_require_ml_truncated_checkpoint_carries_cause(
580581
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
581582
) -> None:
582583
pytest.importorskip("torch")
584+
pytest.importorskip("transformers")
583585
monkeypatch.delenv("UNPLUG_MODEL_PATH", raising=False)
584586
ckpt = tmp_path / "truncated"
585587
_write_checkpoint(ckpt, config='{"model_type": "deberta-v2"')

0 commit comments

Comments
 (0)