#21122: runtests.py fails while trying to clean up temp directory on Windows
-----------------------------------+--------------------
     Reporter:  marfire            |      Owner:  nobody
         Type:  Bug                |     Status:  new
    Component:  Testing framework  |    Version:  master
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 There are two unfortunate aspects to this. One is that most test runs end
 like this:

 {{{
 #!python
 Traceback (most recent call last):
   File "runtests.py", line 374, in <module>
     options.failfast, args)
   File "runtests.py", line 220, in django_tests
     teardown(state)
   File "runtests.py", line 188, in teardown
     shutil.rmtree(six.text_type(TEMP_DIR))
   File "C:\Program Other\Python27\Lib\shutil.py", line 252, in rmtree
     onerror(os.remove, fullname, sys.exc_info())
   File "C:\Program Other\Python27\Lib\shutil.py", line 250, in rmtree
     os.remove(fullname)
 WindowsError: [Error 32] The process cannot access the file because it is
 being used by another process:
 u'c:\\users\\me\\appdata\\local\\temp\\django_ekeere\\tmprx3hfn'
 }}}

 The other is that the temp directory isn't removed. That's not a severe
 problem when it comes to temp files and directories, but it's not
 particularly nice either.

 As indicated in the stack trace, the error is caused by the calls to
 `os.remove()` in `shutil.rmtree()` in `runtests.teardown()`. As indicated
 in the `os.remove()` documentation: "On Windows, attempting to remove a
 file that is in use causes an exception to be raised." This includes files
 opened by the current process.

 The root cause of this, then, is that a number of tests open temporary
 files but never close them, thus preventing the cleanup process from
 working properly.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21122>
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/050.8cd82c7e97064e6ededac02702fb615d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to