File size: 654 Bytes
dc4f25f
313814b
81fa68b
 
5aa421e
dc4f25f
81fa68b
dc4f25f
313814b
 
 
 
dc4f25f
313814b
 
 
81fa68b
 
 
 
 
 
5aa421e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from collections.abc import Generator
import logging

from fastapi.testclient import TestClient
from openai import OpenAI
import pytest

from faster_whisper_server.main import app

disable_loggers = ["multipart.multipart", "faster_whisper"]


def pytest_configure() -> None:
    for logger_name in disable_loggers:
        logger = logging.getLogger(logger_name)
        logger.disabled = True


@pytest.fixture()
def client() -> Generator[TestClient, None, None]:
    with TestClient(app) as client:
        yield client


@pytest.fixture()
def openai_client(client: TestClient) -> OpenAI:
    return OpenAI(api_key="cant-be-empty", http_client=client)