ml_deploy / app /test /fixture.py
gpicciuca's picture
First commit
058f1d9
raw
history blame contribute delete
519 Bytes
import pytest
from fastapi.testclient import TestClient
from main import app
import os
@pytest.fixture()
def app_client():
"""
Barebone test fixture that initializes a FastAPI TestClient
which can be used to test all endpoints provided by the application.
Yields:
TestClient: A client hosting the whole application so that it
can be accessed and controlled programmatically.
"""
os.environ["TEST_MODE"] = "1" # Turns off actual model training
client = TestClient(app)
yield client