From 7355fc365b7f6efa3ff4ea70854567803418e59d Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:10:42 +0100 Subject: [PATCH] do not dispose conftests --- cashu/core/db.py | 4 ++-- tests/conftest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cashu/core/db.py b/cashu/core/db.py index b96750f5..2a575dde 100644 --- a/cashu/core/db.py +++ b/cashu/core/db.py @@ -206,9 +206,9 @@ def _is_lock_exception(e): session: AsyncSession = self.async_session() # type: ignore try: logger.trace(f"Connecting to database trial: {trial} ({random_int})") - async with session.begin(): # type: ignore + async with session.begin() as txn: # type: ignore logger.trace("Connected to database. Starting transaction") - wconn = Connection(session, None, self.type, self.name, self.schema) + wconn = Connection(session, txn, self.type, self.name, self.schema) if lock_table: await self.acquire_lock( wconn, lock_table, lock_select_statement diff --git a/tests/conftest.py b/tests/conftest.py index e9ca102e..3a0ce2b9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -92,7 +92,7 @@ async def start_mint_init(ledger: Ledger) -> Ledger: # drop all tables await conn.execute("DROP SCHEMA public CASCADE;") await conn.execute("CREATE SCHEMA public;") - await db.engine.dispose() + # await db.engine.dispose() wallets_module = importlib.import_module("cashu.lightning") lightning_backend_sat = getattr(wallets_module, settings.mint_backend_bolt11_sat)(