You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the connection is close by some one, probably client, before the function is over.
the test case can pass if I use the @pytest.mark.django_db(transaction=True) marker. But I don't know the reason.
The text was updated successfully, but these errors were encountered:
I was having a similar issue, but with (I assume) a significant difference of not using @async_unsafe.
In my case, I was using a fixture to create a requests client - https://www.django-rest-framework.org/api-guide/testing/#requestsclient. After some experiments, I figured out that using this client instead of the usual django client resulted in connection already closed errors - perhaps the testing django client is more closely tied to the test flow?
Just wanted to say that adding @pytest.mark.django_db(transaction=True) made these tests pass for my own project.
I experienced a similar issue when using graphene-python's test utils. This issue would only occur in CI and I could not replicate it locally (the test would pass).
I did a bit of digging and see that within the graphQL view implementation, the call to graphql-core to execute the query leads to some async functionality. I suspect this would have something to do with it, but it's well beyond my knowledge at the moment 😕
environment:
the error log
the test case
It seems like the connection is close by some one, probably
client
, before the function is over.the test case can pass if I use the
@pytest.mark.django_db(transaction=True)
marker. But I don't know the reason.The text was updated successfully, but these errors were encountered: