File size: 424 Bytes
ced1295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations

import os
from pathlib import Path

import pytest
from fastapi.testclient import TestClient

from src.app import app
from src.db.sqlite_db import init_db


@pytest.fixture(autouse=True)
def isolate_db(tmp_path: Path):
    old_cwd = os.getcwd()
    os.chdir(tmp_path)
    init_db()
    yield
    os.chdir(old_cwd)


@pytest.fixture()
def client() -> TestClient:
    return TestClient(app)