Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
huggingface.py21 linesDownload Raw Back to __mock
1import os2 3import pytest4from _pytest.monkeypatch import MonkeyPatch5from huggingface_hub import InferenceClient6 7from tests.integration_tests.model_runtime.__mock.huggingface_chat import MockHuggingfaceChatClass8 9MOCK = os.getenv("MOCK_SWITCH", "false").lower() == "true"10 11 12@pytest.fixture13def setup_huggingface_mock(request, monkeypatch: MonkeyPatch):14    if MOCK:15        monkeypatch.setattr(InferenceClient, "text_generation", MockHuggingfaceChatClass.text_generation)16 17    yield18 19    if MOCK:20        monkeypatch.undo()21