"Event Loop is Closed" During Tests #1094
-
Hello all, I'm running into a scenario using the test client where asyncio is raising "event loop is closed". I'm trying to narrow it down into a minimal example, but haven't gotten there yet. In the meantime, I'm hoping someone has ran into a similar issue and can share their experience to at least help me narrow down the issue. Some details:
The tests that only use Here's a sample stack trace when using the "real" DB:
One thing that has been bothering me - regardless of using a mock or real DB, my test client fixture doesn't appear to run the
I have to to include an additional fixture:
...and then ensure it is referenced in data fixtures (or enable
I'm sorry, I know this post is all over the place. I'm at a loss for narrowing all of this down. I'm guessing that there is some issue with competing lifecycle managers. Thanks for your time and any direction that can be offered. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Can you provide a reproducible example or at least include the code of the test that causes this error? Also, how are you using the |
Beta Was this translation helpful? Give feedback.
Can you provide a reproducible example or at least include the code of the test that causes this error?
Also, how are you using the
test_client
fixture? The fact that it’s not running the lifecycle hooks tells me there might be something wrong about that.