Skip to content

Commit b594dee

Browse files
committed
fix lint error
1 parent 5ede530 commit b594dee

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

app/api/shakespeare.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Annotated
22

33
from fastapi import APIRouter, Depends, Query
4-
from fastapi_cache.decorator import cache
54
from sqlalchemy.ext.asyncio import AsyncSession
65

76
from app.database import get_db
@@ -13,7 +12,6 @@
1312
@router.get(
1413
"/",
1514
)
16-
@cache(namespace="test-2", expire=60)
1715
async def find_paragraph(
1816
character: Annotated[str, Query(description="Character name")],
1917
db_session: AsyncSession = Depends(get_db),

app/main.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from apscheduler.datastores.sqlalchemy import SQLAlchemyDataStore
66
from apscheduler.eventbrokers.redis import RedisEventBroker
77
from fastapi import Depends, FastAPI
8-
from fastapi_cache import FastAPICache
9-
from fastapi_cache.backends.redis import RedisBackend
108

119
from app.api.health import router as health_router
1210
from app.api.nonsense import router as nonsense_router
@@ -15,7 +13,7 @@
1513
from app.api.user import router as user_router
1614
from app.config import settings as global_settings
1715
from app.database import engine
18-
from app.redis import get_cache, get_redis
16+
from app.redis import get_redis
1917
from app.services.auth import AuthBearer
2018
from app.services.scheduler import SchedulerMiddleware
2119
from app.utils.logging import AppLogger
@@ -31,10 +29,7 @@ async def lifespan(_app: FastAPI):
3129
_postgres_dsn = global_settings.postgres_url.unicode_string()
3230

3331
try:
34-
# Initialize the cache with the redis connection
35-
redis_cache = await get_cache()
36-
FastAPICache.init(RedisBackend(redis_cache), prefix="fastapi-cache")
37-
# logger.info(FastAPICache.get_cache_status_header())
32+
# TODO: cache with the redis connection
3833
# Initialize the postgres connection pool
3934
_app.postgres_pool = await asyncpg.create_pool(
4035
dsn=_postgres_dsn,

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from collections.abc import AsyncGenerator
2+
from typing import Any
3+
14
import pytest
25
from httpx import ASGITransport, AsyncClient
36

@@ -28,12 +31,11 @@ async def start_db():
2831

2932

3033
@pytest.fixture(scope="session")
31-
async def client(start_db) -> AsyncClient:
34+
async def client(start_db) -> AsyncGenerator[AsyncClient, Any]: # noqa: ARG001
3235
transport = ASGITransport(
3336
app=app,
3437
)
3538
async with AsyncClient(
36-
# app=app,
3739
base_url="http://testserver/v1",
3840
headers={"Content-Type": "application/json"},
3941
transport=transport,

0 commit comments

Comments
 (0)