This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Repository navigation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm using
Python 3.9.7,databases 0.4.3,asyncpg 0.24.0.Relevant files/snippets:
tests.py
db.py
some_test.py
The code above works, however, connecting and disconnecting on every unit test is taking around 400ms, which is very slow when dealing with a large amount of unit tests. What is the proper/recommended way of dealing with async database connections in the context of unit tests?
Things I tried:
dal.connect()totests.py, but that file is not in the asyncio context, therefore I cannotawaittheconnect()function.tests.pyjust so I canawaittheconnect()function, but this approach throws:dal.connect()only once, rather than on every test, but it throws:All reactions