summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-06-23 14:51:53 +0200
committerClaude Paroz <claude@2xlibre.net>2014-06-23 14:59:39 +0200
commitc38e47bec02d67fe9497fb384fafb5f2806cff0b (patch)
tree45f07b80e5dab3a04e34cebf5b837d8f317d0280 /tests
parentef3ae3d1c94ac1d4ffaeeeec1ee544e91431e65b (diff)
[1.6.x] Created import-time test temp dirs in known location
Refs #17215. In the same spirit as 5de31cb8cb. Backport of 809362518d from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/bug639/models.py3
-rw-r--r--tests/file_uploads/tests.py2
-rw-r--r--tests/model_fields/models.py2
3 files changed, 4 insertions, 3 deletions
diff --git a/tests/bug639/models.py b/tests/bug639/models.py
index fa8e7d2c07..47c4ba4881 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)
class Photo(models.Model):
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 45e7342abd..a973a9e4c9 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')
@override_settings(MEDIA_ROOT=MEDIA_ROOT)
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index 8c304cc726..a1e1a88595 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -132,7 +132,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')