#22420: Postgresql connections not being dropped between tests?
-----------------------------------+--------------------------------------
Reporter: bacongobbler | Owner: nobody
Type: Bug | Status: closed
Component: Testing framework | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by trueqbit):
Stable decorator that closes the connections in all cases:
{{{
def close_db_connections(func, *args, **kwargs):
"""
Decorator to explicitly close db connections during threaded execution
Note this is necessary to work around:
https://code.djangoproject.com/ticket/22420
"""
def _close_db_connections(*args, **kwargs):
try:
func(*args, **kwargs)
finally:
for conn in connections.all():
conn.close()
return _close_db_connections
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22420#comment:17>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.5f94711a37926a586344cb6e1318dccd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.