Skip to content

Commit

Permalink
Add test for mt w/connect & close.
Browse files Browse the repository at this point in the history
Refs #2874
  • Loading branch information
coleifer committed Apr 22, 2024
1 parent 7dcaf9c commit 1191506
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/db_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,21 @@ def read_user_count(n):
for t in threads: t.join()
self.assertEqual(data.qsize(), self.nrows * self.nthreads)

def test_mt_general(self):
def connect_close():
for _ in range(self.nrows):
self.database.connect()
with self.database.atomic() as txn:
self.database.execute_sql('select 1').fetchone()
self.database.close()

threads = []
for i in range(self.nthreads):
threads.append(threading.Thread(target=connect_close))

for t in threads: t.start()
for t in threads: t.join()


class TestDeferredDatabase(BaseTestCase):
def test_deferred_database(self):
Expand Down

0 comments on commit 1191506

Please sign in to comment.