Skip to content

Commit

Permalink
fix: add conditional for tests on lib installs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescalam committed Nov 30, 2024
1 parent 5c64e33 commit 084dedc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
11 changes: 7 additions & 4 deletions tests/unit/encoders/test_clip.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/encoders/test_vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
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
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/llms/test_llm_llamacpp.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 084dedc

Please sign in to comment.