diff --git a/tests/unit/encoders/test_clip.py b/tests/unit/encoders/test_clip.py index 1cfc7d4313a1a17302dff195ac71e137e3ae4581..297761519f29870723970da7f6ece10e98ed9ff8 100644 --- a/tests/unit/encoders/test_clip.py +++ b/tests/unit/encoders/test_clip.py @@ -1,11 +1,14 @@ import os import numpy as np import pytest -import torch -from PIL import Image -from unittest.mock import patch -from semantic_router.encoders import CLIPEncoder +_ = pytest.importorskip("torch") + +import torch # noqa: E402 +from PIL import Image # noqa: E402 +from unittest.mock import patch # noqa: E402 + +from semantic_router.encoders import CLIPEncoder # noqa: E402 test_model_name = "aurelio-ai/sr-test-clip" embed_dim = 64 diff --git a/tests/unit/encoders/test_vit.py b/tests/unit/encoders/test_vit.py index b598a818a3af0753a0627fead4801a56c5b03f54..622b22689f327054392a98cb336ec3f40adee6cd 100644 --- a/tests/unit/encoders/test_vit.py +++ b/tests/unit/encoders/test_vit.py @@ -3,10 +3,13 @@ from unittest.mock import patch import os import numpy as np import pytest -import torch -from PIL import Image -from semantic_router.encoders import VitEncoder +_ = pytest.importorskip("torch") + +import torch # noqa: E402 +from PIL import Image # noqa: E402 + +from semantic_router.encoders import VitEncoder # noqa: E402 test_model_name = "aurelio-ai/sr-test-vit" embed_dim = 32 diff --git a/tests/unit/llms/test_llm_llamacpp.py b/tests/unit/llms/test_llm_llamacpp.py index 04a3ad3bc5528d8797ec326b444ba6af2db1c236..fc9813faad19f8c69cf7a21cff9d614d8fc62888 100644 --- a/tests/unit/llms/test_llm_llamacpp.py +++ b/tests/unit/llms/test_llm_llamacpp.py @@ -1,10 +1,13 @@ from unittest.mock import patch import pytest -from llama_cpp import Llama -from semantic_router.llms.llamacpp import LlamaCppLLM -from semantic_router.schema import Message +_ = pytest.importorskip("llama_cpp") + +from llama_cpp import Llama # noqa: E402 + +from semantic_router.llms.llamacpp import LlamaCppLLM # noqa: E402 +from semantic_router.schema import Message # noqa: E402 @pytest.fixture