Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 0574edf

Browse files
Add test case for concurrent access
1 parent 27b208d commit 0574edf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_databases.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,17 @@ async def test_database_url_interface(database_url):
699699
async with Database(database_url) as database:
700700
assert isinstance(database.url, DatabaseURL)
701701
assert database.url == database_url
702+
703+
704+
@pytest.mark.parametrize("database_url", DATABASE_URLS)
705+
@async_adapter
706+
async def test_concurrent_access_on_single_connection(database_url):
707+
async with Database(database_url, force_rollback=True) as database:
708+
async def db_lookup():
709+
if str(database_url).startswith("postgresql"):
710+
await database.fetch_one("SELECT pg_sleep(1)")
711+
712+
await asyncio.gather(
713+
db_lookup(),
714+
db_lookup(),
715+
)

0 commit comments

Comments
 (0)