import pytest from constants import EMBEDDING_BACKEND from Calculators.EmbeddingCalculator import EmbeddingCalculator @pytest.mark.manual def test_cpu_embedding_uses_backend(): """ One-time manual check: confirms CPU embedding loads with specified backend from constants. Run with: pytest -m manual --no-cov Not run in standard CI. """ calc = EmbeddingCalculator.__new__(EmbeddingCalculator) calc._model = None calc._device = "cpu" EmbeddingCalculator._load_model(calc) assert calc._model is not None, "Model failed to load" backend = getattr(calc._model, "backend", "") model_type = str(type(calc._model)).lower() assert EMBEDDING_BACKEND in backend.lower() or EMBEDDING_BACKEND in model_type, ( f"Expected {EMBEDDING_BACKEND} backend. " f"Got: type={type(calc._model)}, backend={backend!r}. " "Ensure 'optimum[onnxruntime]' is installed." )