Skip to content

Commit

Permalink
fix: set expire_on_commit=False in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cofin committed Jul 1, 2023
1 parent 8519bb5 commit 52a01de
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def engine(request: FixtureRequest) -> Engine:

@pytest.fixture()
def session(engine: Engine) -> Generator[Session, None, None]:
session = sessionmaker(bind=engine)()
session = sessionmaker(bind=engine, expire_on_commit=False)()
try:
yield session
finally:
Expand Down Expand Up @@ -402,7 +402,7 @@ def async_engine(request: FixtureRequest) -> AsyncEngine:

@pytest.fixture()
async def async_session(async_engine: AsyncEngine) -> AsyncGenerator[AsyncSession, None]:
session = async_sessionmaker(bind=async_engine)()
session = async_sessionmaker(bind=async_engine, expire_on_commit=False)()
try:
yield session
finally:
Expand Down

0 comments on commit 52a01de

Please sign in to comment.