﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15362	The file_uploads tests are failing on Windows	Miloslav Pojman	nobody	"The reason is known and commented:

{{{
# Cleanup the object with its exotic file name immediately.
# (shutil.rmtree used elsewhere in the tests to clean up the
# upload directory has been seen to choke on unicode
# filenames on Windows.)
}}}
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/file_uploads/views.py?rev=15599#L69

But the current fix (deleting a model instance) does not help.

I'm attaching a patch with a trivial fix.


Before patch:
{{{
C:\devel\python\django\tests>runtests.py --settings=test_sqlite file_uploads
Creating test database for alias 'default'...
Creating test database for alias 'other'...
.........EE.
======================================================================
ERROR: test_not_a_directory (regressiontests.file_uploads.tests.DirectoryCreatio
nTests)
The correct IOError is raised when the upload directory name exists but isn't a
directory
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""C:\devel\python\django\tests\regressiontests\file_uploads\tests.py"", lin
e 266, in setUp
    shutil.rmtree(UPLOAD_TO)
  File ""C:\Program Files\python25\lib\shutil.py"", line 174, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File ""C:\Program Files\python25\lib\shutil.py"", line 172, in rmtree
    os.remove(fullname)
WindowsError: [Error 123] Nßzev souboru, adresß°e nebo jmenovka svazku je nesprß
vn: 'c:\\docume~1\\milosl~1.poj\\locals~1\\temp\\tmpburruj\\test_upload\\test-01
23456789_??_orl\xe9ans.jpg'

======================================================================
ERROR: test_readonly_root (regressiontests.file_uploads.tests.DirectoryCreationT
ests)
Permission errors are not swallowed
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""C:\devel\python\django\tests\regressiontests\file_uploads\tests.py"", lin
e 266, in setUp
    shutil.rmtree(UPLOAD_TO)
  File ""C:\Program Files\python25\lib\shutil.py"", line 174, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File ""C:\Program Files\python25\lib\shutil.py"", line 172, in rmtree
    os.remove(fullname)
WindowsError: [Error 123] Nßzev souboru, adresß°e nebo jmenovka svazku je nesprß
vn: 'c:\\docume~1\\milosl~1.poj\\locals~1\\temp\\tmpburruj\\test_upload\\test-01
23456789_??_orl\xe9ans.jpg'

----------------------------------------------------------------------
Ran 12 tests in 16.655s

FAILED (errors=2)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
}}}

After patch:
{{{
C:\devel\python\django\tests>runtests.py --settings=test_sqlite file_uploads
Creating test database for alias 'default'...
Creating test database for alias 'other'...
............
----------------------------------------------------------------------
Ran 12 tests in 113.876s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
}}}
"		closed	File uploads/storage	dev		fixed			Accepted	1	0	0	0	0	0
