#15364 closed (fixed)
TestCase files.FileTests failing on Windows
Reported by: | Miloslav Pojman | Owned by: | nobody |
---|---|---|---|
Component: | File uploads/storage | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The reason is that Windows can not delete a file which is open.
I'm attaching a patch which fixes it by closing the opened files.
Before patch:
C:\devel\python\django\tests>runtests.py --settings=test_sqlite files.FileTests Creating test database for alias 'default'... Creating test database for alias 'other'... EE ====================================================================== ERROR: test_files (modeltests.files.tests.FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\devel\python\django\tests\modeltests\files\tests.py", line 100, in te st_files obj3.default.delete() File "C:\devel\python\django\django\db\models\fields\files.py", line 111, in d elete self.storage.delete(self.name) File "C:\devel\python\django\django\core\files\storage.py", line 215, in delet e os.remove(name) WindowsError: [Error 32] Proces nemß p°Ýstup k souboru, neboŁ jej prßvý vyu×Ývß jinř proces: u'c:\\docume~1\\milosl~1.poj\\locals~1\\temp\\tmpahds2v\\tests\\def ault.txt' ====================================================================== ERROR: test_files (modeltests.files.tests.FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\devel\python\django\tests\modeltests\files\tests.py", line 16, in tea rDown shutil.rmtree(temp_storage_location) File "C:\Program Files\python25\lib\shutil.py", line 169, in rmtree rmtree(fullname, ignore_errors, onerror) 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 32] Proces nemß p°Ýstup k souboru, neboŁ jej prßvý vyu×Ývß jinř proces: 'c:\\docume~1\\milosl~1.poj\\locals~1\\temp\\tmpahds2v\\tests\\defa ult.txt' ---------------------------------------------------------------------- Ran 1 test in 0.062s 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 files.FileTests Creating test database for alias 'default'... Creating test database for alias 'other'... . ---------------------------------------------------------------------- Ran 1 test in 0.046s OK Destroying test database for alias 'default'... Destroying test database for alias 'other'...
Attachments (1)
Change History (4)
by , 14 years ago
Attachment: | FileTests.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In [15604]: