Tests with WebsocketCommunicator and Django ORM never complete #2045
Unanswered
emammadov-cpr
asked this question in
Help!
Replies: 2 comments 3 replies
-
Hi @emammadov-cpr — Nice example.
So is the first task blocking the second, unless it's able to finish cleanly? 🤔 |
Beta Was this translation helpful? Give feedback.
1 reply
-
The |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not 100% sure if this is a question for channels or django community. Starting here.
I am working on writing tests that make use of
WebsocketCommunicator
while also making database calls in the same test case. If the database calls are made before connecting viaWebsocketCommunicator
the test completes. But if the database calls are made after the connection has been established, the test never completes. Minimal setup:The following test case never completes:
where
With the switched order of operations:
the test completes.
Consumer:
application:
Version:
Couple other things that I have found out:
Searching online I haven't found any description that matches the test setup where the issue happens. Usually the db calls are made before the test client is connected.In which case it works.
What could be preventing the async test from completing as described in the initial setup?
Beta Was this translation helpful? Give feedback.
All reactions