Skip to content

Commit

Permalink
test: skip test of mp3_reader when librosa not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
cin-albert committed Dec 27, 2024
1 parent 32b1ee0 commit 1335a0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libs/kotaemon/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def if_llama_cpp_not_installed():
return False


def if_transformers_not_installed():
def if_librosa_not_installed():
try:
import transformers # noqa: F401
import librosa # noqa: F401
except ImportError:
return True
else:
Expand Down Expand Up @@ -107,6 +107,6 @@ def if_transformers_not_installed():
if_llama_cpp_not_installed(), reason="llama_cpp is not installed"
)

skip_when_transformers_not_installed = pytest.mark.skipif(
if_transformers_not_installed(), reason="transformers is not installed"
skip_when_librosa_not_installed = pytest.mark.skipif(
if_librosa_not_installed(), reason="librosa is not installed"
)
4 changes: 2 additions & 2 deletions libs/kotaemon/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

from .conftest import (
skip_when_transformers_not_installed,
skip_when_librosa_not_installed,
skip_when_unstructured_pdf_not_installed,
)

Expand Down Expand Up @@ -99,7 +99,7 @@ def test_azureai_document_intelligence_reader(mock_client):
mock_client.assert_called_once()


@skip_when_transformers_not_installed
@skip_when_librosa_not_installed
@patch("kotaemon.loaders.MP3Reader.asr_pipeline")
def test_mp3_reader(mock_pipeline):
# Mock the return value
Expand Down

0 comments on commit 1335a0b

Please sign in to comment.