RuntimeError during unit tests: Future attached to a different loop #10518
Unanswered
prashantgupta24
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
Quoting from here: sysid/sse-starlette#68. Asking question here since no response in
sse_starlette
:I tried to write pytest testcases for a FastAPI route that returns an event source/stream. The first test always succeedes, but the second test, despite identical content, consistently runs into an error: RuntimeError: Task ... got Future ... attached to a different loop. I'm not sure if the error is related to sse_starlette, fastapi, httpx or pytest-asyncio.
Operating System
macOS
Operating System Details
No response
FastAPI Version
0.104.0
Pydantic Version
2.4.2
Python Version
3.9.2
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions