File size: 564 Bytes
bbda63d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""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