Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Be nice to buildbots: switched `modeltests/files` to use a proper iso…

…lated directory for file storage

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 9a72913 commit c1851350687eb8aed5fd51db37c2eca35b2167cd @jacobian jacobian committed
Showing with 5 additions and 4 deletions.
  1. +5 −4 tests/modeltests/files/
9 tests/modeltests/files/
@@ -5,14 +5,15 @@
and where files should be stored.
+import shutil
import tempfile
from django.db import models
from django.core.files.base import ContentFile
from import FileSystemStorage
from django.core.cache import cache
-temp_storage = FileSystemStorage(location=tempfile.gettempdir())
+temp_storage_location = tempfile.mkdtemp()
+temp_storage = FileSystemStorage(location=temp_storage_location)
# Write out a file to be used as default content'tests/default.txt', ContentFile('default content'))
@@ -109,10 +110,10 @@ def random_upload_to(self, filename):
>>> obj4.random
<FieldFile: .../random_file>
-# Clean up the temporary files.
+# Clean up the temporary files and dir.
>>> obj1.normal.delete()
>>> obj2.normal.delete()
>>> obj3.default.delete()
>>> obj4.random.delete()
+>>> shutil.rmtree(temp_storage_location)

0 comments on commit c185135

Please sign in to comment.
Something went wrong with that request. Please try again.