#19905: ResourceWarning in formtools tests
-----------------------------------+------------------------------------
     Reporter:  apollo13           |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  contrib.formtools  |                  Version:  master
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------

Comment (by claudep):

 Basically, the explanation of this behavior is rather straightforward: at
 various steps, formtools is reopening files (in `get_step_files`) to
 provide them to the wizard form(s), a bit like a standard `UploadHandler`
 does it for data coming from a request to populate `request.FILES` (and
 then form files data).
 If we look at the same process with standard forms, we can see that we
 don't explicitly close the files either (not an issue with
 `InMemoryUploadedFile`, not sure about `TemporaryUploadedFile` for bigger
 files). In standard form tests, it's easy to manually close files as we
 are opening them ourselves. It's different in formtools tests, as those
 files are reopened inside formtools code.

 This leaves us with two paths:
 1. We don't think that not explicitly closing files in this situation is a
 problem, and we should then simply silence the warnings (didn't try if
 it's possible or not) or live with them.
 2. We do think that open files provided to forms with file fields should
 be explicitly closed at some point in the code (and not artifically in
 test code). But then the resolution is not in formtools, but in the form
 infrastructure itself.

 I have doubts that 2 is feasible, so I'm afraid we are left with 1.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19905#comment:7>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.c30ee1e6739c5017855dcb8442338b4c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to