-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
"InterfaceError: connection already closed" being raised when a test is run #167
Comments
+1 |
Can confirm this on Django 1.9.7 / Python 3.5.1 / PostgreSQL.
EDIT: some info
|
All the Travis CI tests are run with sqlite3. What I'll try to do this week is add postgres to it. That is probably a fairer representation of what most people with use anyway. |
Turns out this is something both django https://code.djangoproject.com/ticket/15802 and Celery struggle with too celery/django-celery#121 |
I think I've come up with a solution. I'm now using TransactionTestCase class instead of TestCase. This keeps connection alive. Note that I'm using Django Q and not Celery. |
My tests passes with TransactionTestCase (or in my case pytest.mark.django_db(transaction=True)) with celery_worker fixture. Looks like connection is not dropped anymore. |
Seems this issue can be closed because the fix is known. |
Hello,
First off, congratulations on this awesome app. I am using Python 2.7, Django 1.9 and Postgresql 9.3.
Settings dict for django-q is as follows:
This is what I have in tests.py:
When tests are run, this is what I get:
PS: The error still occurs
if async(..., sync=True)
format is used.The text was updated successfully, but these errors were encountered: