-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
django.db.utils.InterfaceError: connection already closed when running pytest #1099
Comments
I was having a similar issue, but with (I assume) a significant difference of not using 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 environment info: |
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: