Skip to content

Commit 5668138

Browse files
Test await connection.close() always returns an empty transaction queue
1 parent c1096fe commit 5668138

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

aiosqlite/tests/smoke.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,17 @@ async def test_cursor_on_closed_connection_loop(self):
413413
except sqlite3.ProgrammingError:
414414
pass
415415

416+
async def test_close_blocking_until_transaction_queue_empty(self):
417+
db = await aiosqlite.connect(self.db)
418+
# Insert transactions into the
419+
# transaction queue '_tx'
420+
for i in range(1000):
421+
await db.execute(f"select 1, {i}")
422+
# Wait for all transactions to complete
423+
await db.close()
424+
# Check no more transaction pending
425+
self.assertEqual(db._tx.empty(), True)
426+
416427
async def test_close_twice(self):
417428
db = await aiosqlite.connect(self.db)
418429

0 commit comments

Comments
 (0)