autoapp-builder / tests /conftest.py
ruslanmv's picture
fix: escape curly braces in chatbot template to prevent KeyError with .format()
bbda63d verified
"""Shared fixtures for AutoApp Builder tests."""
import sys
from pathlib import Path
import pytest
# Ensure imports resolve from the hf/ directory.
HF_ROOT = Path(__file__).resolve().parent.parent
if str(HF_ROOT) not in sys.path:
sys.path.insert(0, str(HF_ROOT))
from app.main import app as fastapi_app
@pytest.fixture()
def client():
"""Synchronous test client for the FastAPI app using Starlette's TestClient."""
from starlette.testclient import TestClient
with TestClient(fastapi_app, raise_server_exceptions=False) as c:
yield c