diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-06-23 14:51:53 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-06-23 14:54:25 +0200 |
| commit | 809362518d6dbb7ca989b32ed97b39f6156563b9 (patch) | |
| tree | 859cbd8ab49b179103afb95e0708f6c4cf4c21c7 | |
| parent | 1d9596025e53a33763d9dbb61e7dda015ec60b25 (diff) | |
Created import-time test temp dirs in known location
Refs #17215. In the same spirit as 5de31cb8cb.
| -rw-r--r-- | tests/bug639/models.py | 3 | ||||
| -rw-r--r-- | tests/file_storage/models.py | 3 | ||||
| -rw-r--r-- | tests/file_uploads/tests.py | 2 | ||||
| -rw-r--r-- | tests/model_fields/models.py | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/tests/bug639/models.py b/tests/bug639/models.py index 3b6a007f6b..db34532025 100644 --- a/tests/bug639/models.py +++ b/tests/bug639/models.py @@ -1,3 +1,4 @@ +import os import tempfile from django.core.files.storage import FileSystemStorage @@ -5,7 +6,7 @@ from django.db import models from django.forms import ModelForm -temp_storage_dir = tempfile.mkdtemp() +temp_storage_dir = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']) temp_storage = FileSystemStorage(temp_storage_dir) diff --git a/tests/file_storage/models.py b/tests/file_storage/models.py index 738a3a1772..1ce9a26956 100644 --- a/tests/file_storage/models.py +++ b/tests/file_storage/models.py @@ -5,6 +5,7 @@ and where files should be stored. """ +import os import random import tempfile @@ -12,7 +13,7 @@ from django.db import models from django.core.files.storage import FileSystemStorage -temp_storage_location = tempfile.mkdtemp() +temp_storage_location = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']) temp_storage = FileSystemStorage(location=temp_storage_location) diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 1e2ba488e6..9ba7d097f4 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -23,7 +23,7 @@ from .models import FileModel UNICODE_FILENAME = 'test-0123456789_中文_Orléans.jpg' -MEDIA_ROOT = sys_tempfile.mkdtemp() +MEDIA_ROOT = sys_tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']) UPLOAD_TO = os.path.join(MEDIA_ROOT, 'test_upload') diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index 0222f9a3df..30140a7231 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -194,7 +194,7 @@ if Image: attr_class = TestImageFieldFile # Set up a temp directory for file storage. - temp_storage_dir = tempfile.mkdtemp() + temp_storage_dir = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']) temp_storage = FileSystemStorage(temp_storage_dir) temp_upload_to_dir = os.path.join(temp_storage.location, 'tests') |
