summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/formtools/tests/wizard/wizardtests/forms.py3
-rw-r--r--tests/modeltests/model_forms/models.py3
-rw-r--r--tests/regressiontests/admin_views/admin.py2
-rw-r--r--tests/regressiontests/admin_views/models.py4
-rw-r--r--tests/regressiontests/forms/models.py3
-rw-r--r--tests/regressiontests/staticfiles_tests/tests.py2
-rwxr-xr-xtests/runtests.py1
7 files changed, 11 insertions, 7 deletions
diff --git a/django/contrib/formtools/tests/wizard/wizardtests/forms.py b/django/contrib/formtools/tests/wizard/wizardtests/forms.py
index bbc96c3453..9013e89aef 100644
--- a/django/contrib/formtools/tests/wizard/wizardtests/forms.py
+++ b/django/contrib/formtools/tests/wizard/wizardtests/forms.py
@@ -1,3 +1,4 @@
+import os
import tempfile
from django import forms
@@ -10,7 +11,7 @@ from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import WizardView
-temp_storage_location = tempfile.mkdtemp()
+temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
temp_storage = FileSystemStorage(location=temp_storage_location)
class Page1(forms.Form):
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index a960611ffa..35fc9a7bc1 100644
--- a/tests/modeltests/model_forms/models.py
+++ b/tests/modeltests/model_forms/models.py
@@ -7,13 +7,14 @@ and the examples are probably a poor fit for the ``ModelForm`` syntax. In other
words, most of these tests should be rewritten.
"""
+import os
import tempfile
from django.core.files.storage import FileSystemStorage
from django.db import models
-temp_storage_dir = tempfile.mkdtemp()
+temp_storage_dir = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
temp_storage = FileSystemStorage(temp_storage_dir)
ARTICLE_STATUS = (
diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py
index 8c45ba3626..66e76dd369 100644
--- a/tests/regressiontests/admin_views/admin.py
+++ b/tests/regressiontests/admin_views/admin.py
@@ -260,7 +260,7 @@ class OldSubscriberAdmin(admin.ModelAdmin):
actions = None
-temp_storage = FileSystemStorage(tempfile.mkdtemp())
+temp_storage = FileSystemStorage(tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']))
UPLOAD_TO = os.path.join(temp_storage.location, 'test_upload')
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index fce02189f5..d1a5d19dd0 100644
--- a/tests/regressiontests/admin_views/models.py
+++ b/tests/regressiontests/admin_views/models.py
@@ -246,7 +246,7 @@ class EmptyModel(models.Model):
return "Primary key = %s" % self.id
-temp_storage = FileSystemStorage(tempfile.mkdtemp())
+temp_storage = FileSystemStorage(tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR']))
UPLOAD_TO = os.path.join(temp_storage.location, 'test_upload')
@@ -547,4 +547,4 @@ class PrePopulatedPostLargeSlug(models.Model):
title = models.CharField(max_length=100)
published = models.BooleanField()
slug = models.SlugField(max_length=1000)
- \ No newline at end of file
+
diff --git a/tests/regressiontests/forms/models.py b/tests/regressiontests/forms/models.py
index d4e693436b..939055785a 100644
--- a/tests/regressiontests/forms/models.py
+++ b/tests/regressiontests/forms/models.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+import os
import datetime
import tempfile
@@ -6,7 +7,7 @@ from django.core.files.storage import FileSystemStorage
from django.db import models
-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/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py
index 652ddbd2b2..7f0e431275 100644
--- a/tests/regressiontests/staticfiles_tests/tests.py
+++ b/tests/regressiontests/staticfiles_tests/tests.py
@@ -100,7 +100,7 @@ class BaseCollectionTestCase(BaseStaticFilesTestCase):
def setUp(self):
super(BaseCollectionTestCase, self).setUp()
self.old_root = settings.STATIC_ROOT
- settings.STATIC_ROOT = tempfile.mkdtemp()
+ settings.STATIC_ROOT = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
self.run_collectstatic()
# Use our own error handler that can handle .svn dirs on Windows
#self.addCleanup(shutil.rmtree, settings.STATIC_ROOT,
diff --git a/tests/runtests.py b/tests/runtests.py
index fce03d2325..c38c4c2202 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -19,6 +19,7 @@ CONTRIB_DIR = os.path.dirname(contrib.__file__)
MODEL_TEST_DIR = os.path.join(RUNTESTS_DIR, MODEL_TESTS_DIR_NAME)
REGRESSION_TEST_DIR = os.path.join(RUNTESTS_DIR, REGRESSION_TESTS_DIR_NAME)
TEMP_DIR = tempfile.mkdtemp(prefix='django_')
+os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
REGRESSION_SUBDIRS_TO_SKIP = ['locale']