Skip to content

Commit

Permalink
TST: Fix paths in mocked interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ghisvail committed May 21, 2024
1 parent 3730793 commit 35a6fe6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/unit/audio/segmentation/test_pa_speaker_detector.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import pytest

# must import pandas first, cf workaround description in pa_speaker_detector.py
pytest.importorskip(modname="pandas", reason="pandas (therefore pyannote) is not installed")
pytest.importorskip(modname="pandas", reason="pandas is not installed")
pytest.importorskip(modname="pyannote.audio", reason="pyannote.audio is not installed")

# TODO: Fix broken tests after refactoring in
# https://github.com/medkit-lib/medkit/commit/5bfb16304fdce0136f4179654e3e09d15811e8d7
pytest.skip("Skip broken tests for pa_speaker_detector", allow_module_level=True)

import math
from typing import NamedTuple

Expand Down Expand Up @@ -63,13 +67,9 @@ def apply(self, file, **kwargs):
@pytest.fixture(scope="module", autouse=True)
def _mocked_pipeline(module_mocker):
module_mocker.patch(
"medkit.audio.segmentation.pa_speaker_detector.SpeakerDiarization",
"medkit.audio.segmentation.pa_speaker_detector.PASpeakerDetector",
_MockedPipeline,
)
module_mocker.patch(
"medkit.audio.segmentation.pa_speaker_detector.Pipeline.from_pretrained",
return_value=_MockedPipeline(),
)


def _get_segment(duration):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/text/ner/test_hf_entity_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __call__(self, texts):
@pytest.fixture(scope="module", autouse=True)
def _mocked_pipeline(module_mocker):
module_mocker.patch(
"medkit.text.ner.hf_entity_matcher.hf_utils.check_model_for_task_HF",
"medkit.tools.hf_utils.check_model_for_task_hf",
return_value=True,
)
module_mocker.patch("transformers.pipeline", _MockedPipeline)
Expand Down

0 comments on commit 35a6fe6

Please sign in to comment.