Spaces:
Sleeping

File size: 784 Bytes
8524443
 
 
 
 
72d40e2
8e77468
8524443
 
 
 
 
 
 
 
 
0c3044a
8524443
 
 
 
 
 
 
 
 
72d40e2
8524443
 
 
72d40e2
8e77468
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
"""Shared test fixtures."""

from pathlib import Path

import pytest
from fastapi import FastAPI
from starlette.testclient import TestClient

from jellyscope.config import JellyscopeConfig
from jellyscope.data.data_store import DataStore

SESSION_SCOPE: str = "session"


@pytest.fixture(scope=SESSION_SCOPE)
def config() -> JellyscopeConfig:
    return JellyscopeConfig(data_dir=Path("data"))


@pytest.fixture(scope=SESSION_SCOPE)
def store(config: JellyscopeConfig) -> "DataStore":
    DataStore.reset()
    return DataStore.get(config)


@pytest.fixture
def app(config: JellyscopeConfig) -> FastAPI:
    from jellyscope.web import create_app

    DataStore.reset()
    return create_app(config)


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