#15362 closed (fixed)
The file_uploads tests are failing on Windows
| Reported by: | Miloslav Pojman | Owned by: | nobody |
|---|---|---|---|
| Component: | File uploads/storage | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.)
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'...
Attachments (1)
Change History (6)
by , 15 years ago
| Attachment: | file_uploads.diff added |
|---|
comment:1 by , 15 years ago
| milestone: | → 1.3 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Due to the the fix for #6456.