20 lines
415 B
Python
20 lines
415 B
Python
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from fastapi.testclient import TestClient
|
||
|
|
|
||
|
|
from app.db import configure_database
|
||
|
|
from app.main import create_app
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def client(tmp_path: Path):
|
||
|
|
test_db_path = tmp_path / "test.db"
|
||
|
|
database_url = f"sqlite:///{test_db_path}"
|
||
|
|
|
||
|
|
configure_database(database_url)
|
||
|
|
app = create_app()
|
||
|
|
|
||
|
|
with TestClient(app) as test_client:
|
||
|
|
yield test_client
|