#35618: response.close() in a TestCase prematurely closes PostgreSQL connection 
and
leads to psycopg2.InterfaceError
-------------------------------------+-------------------------------------
     Reporter:  Anders Kaseorg       |                    Owner:  (none)
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     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 Simon Charette):

 In order to prevent this problem from happening under normal circumstances
 `django.test.Client`
 
[https://github.com/django/django/blob/6b3f55446fdc62bd277903fd188a1781e4d92d29/django/test/client.py#L195-L208
 unregisters this signal handler] before calling `request.close`.

 I feel like if you're testing something as low level as `HttpRequest`
 closing in the context of database connection handling
 
[https://github.com/django/django/blob/6b3f55446fdc62bd277903fd188a1781e4d92d29/django/test/client.py#L158C7-L210
 you should be using] `ClientHandler`?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35618#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190c7f3f806-4253db3b-203e-478c-b8a0-a3d544c0c9f3-000000%40eu-central-1.amazonses.com.

Reply via email to