Django

Code

Changeset 9222

Show
Ignore:
Timestamp:
10/10/08 15:09:51 (3 months ago)
Author:
jacob
Message:

Be nice to buildbots: switched modeltests/files to use a proper isolated directory for file storage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/modeltests/files/models.py

    r8325 r9222  
    66""" 
    77 
     8import shutil 
    89import tempfile 
    9  
    1010from django.db import models 
    1111from django.core.files.base import ContentFile 
     
    1313from django.core.cache import cache 
    1414 
    15 temp_storage = FileSystemStorage(location=tempfile.gettempdir()) 
     15temp_storage_location = tempfile.mkdtemp() 
     16temp_storage = FileSystemStorage(location=temp_storage_location) 
    1617 
    1718# Write out a file to be used as default content 
     
    110111<FieldFile: .../random_file> 
    111112 
    112 # Clean up the temporary files. 
    113  
     113# Clean up the temporary files and dir. 
    114114>>> obj1.normal.delete() 
    115115>>> obj2.normal.delete() 
    116116>>> obj3.default.delete() 
    117117>>> obj4.random.delete() 
     118>>> shutil.rmtree(temp_storage_location) 
    118119"""}