Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed Mar 19, 2024
1 parent 8ca59c9 commit 836bc1a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
from src.core import server # noqa: E402
from src.core.fastapi.dependencies.session import get_session # noqa: E402

# Create an async SQLAlchemy engine
engine = create_async_engine(
"mysql+aiomysql://root:root_bot_buster@localhost:3307/playerdata",
pool_timeout=30,
pool_recycle=30,
echo=True,
pool_pre_ping=True,
)

# Create a session factory
SessionFactory = sessionmaker(
bind=engine,
expire_on_commit=False,
class_=AsyncSession, # Use AsyncSession for asynchronous operations
)


async def get_session_override():
# for some reason this has to be in here
# Create an async SQLAlchemy engine
engine = create_async_engine(
"mysql+aiomysql://root:root_bot_buster@localhost:3307/playerdata",
pool_timeout=30,
pool_recycle=30,
echo=True,
pool_pre_ping=True,
)

# Create a session factory
SessionFactory = sessionmaker(
bind=engine,
expire_on_commit=False,
class_=AsyncSession, # Use AsyncSession for asynchronous operations
)
async with SessionFactory() as session:
session: AsyncSession
yield session
Expand Down

0 comments on commit 836bc1a

Please sign in to comment.