Author: kmtracey Date: 2011-11-13 11:05:02 -0800 (Sun, 13 Nov 2011) New Revision: 17094
Modified: django/trunk/django/contrib/formtools/tests/wizard/wizardtests/forms.py django/trunk/tests/modeltests/model_forms/models.py django/trunk/tests/regressiontests/admin_views/admin.py django/trunk/tests/regressiontests/admin_views/models.py django/trunk/tests/regressiontests/forms/models.py django/trunk/tests/regressiontests/staticfiles_tests/tests.py django/trunk/tests/runtests.py Log: Refs #17215: Avoid generating 47 leftover tmp dirs during a clean test run. Modified: django/trunk/django/contrib/formtools/tests/wizard/wizardtests/forms.py =================================================================== --- django/trunk/django/contrib/formtools/tests/wizard/wizardtests/forms.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/django/contrib/formtools/tests/wizard/wizardtests/forms.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -1,3 +1,4 @@ +import os import tempfile from django import forms @@ -10,7 +11,7 @@ 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): Modified: django/trunk/tests/modeltests/model_forms/models.py =================================================================== --- django/trunk/tests/modeltests/model_forms/models.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/modeltests/model_forms/models.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -7,13 +7,14 @@ 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 = ( Modified: django/trunk/tests/regressiontests/admin_views/admin.py =================================================================== --- django/trunk/tests/regressiontests/admin_views/admin.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/regressiontests/admin_views/admin.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -260,7 +260,7 @@ 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') Modified: django/trunk/tests/regressiontests/admin_views/models.py =================================================================== --- django/trunk/tests/regressiontests/admin_views/models.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/regressiontests/admin_views/models.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -246,7 +246,7 @@ 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 @@ title = models.CharField(max_length=100) published = models.BooleanField() slug = models.SlugField(max_length=1000) - \ No newline at end of file + Modified: django/trunk/tests/regressiontests/forms/models.py =================================================================== --- django/trunk/tests/regressiontests/forms/models.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/regressiontests/forms/models.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import os import datetime import tempfile @@ -6,7 +7,7 @@ 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) Modified: django/trunk/tests/regressiontests/staticfiles_tests/tests.py =================================================================== --- django/trunk/tests/regressiontests/staticfiles_tests/tests.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/regressiontests/staticfiles_tests/tests.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -100,7 +100,7 @@ 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, Modified: django/trunk/tests/runtests.py =================================================================== --- django/trunk/tests/runtests.py 2011-11-13 15:09:08 UTC (rev 17093) +++ django/trunk/tests/runtests.py 2011-11-13 19:05:02 UTC (rev 17094) @@ -19,6 +19,7 @@ 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'] -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.