Author: Alex
Date: 2010-10-29 23:24:24 -0500 (Fri, 29 Oct 2010)
New Revision: 14396

Modified:
   django/trunk/tests/regressiontests/staticfiles_tests/tests.py
Log:
Sped up the staticfiles_tests by allowing them to only search a few relevant 
directories, rather than every single test application.

Modified: django/trunk/tests/regressiontests/staticfiles_tests/tests.py
===================================================================
--- django/trunk/tests/regressiontests/staticfiles_tests/tests.py       
2010-10-29 16:48:58 UTC (rev 14395)
+++ django/trunk/tests/regressiontests/staticfiles_tests/tests.py       
2010-10-30 04:24:24 UTC (rev 14396)
@@ -26,11 +26,11 @@
         self.old_staticfiles_root = settings.STATICFILES_ROOT
         self.old_staticfiles_dirs = settings.STATICFILES_DIRS
         self.old_staticfiles_finders = settings.STATICFILES_FINDERS
-        self.old_installed_apps = settings.INSTALLED_APPS
         self.old_media_root = settings.MEDIA_ROOT
         self.old_media_url = settings.MEDIA_URL
         self.old_admin_media_prefix = settings.ADMIN_MEDIA_PREFIX
         self.old_debug = settings.DEBUG
+        self.old_installed_apps = settings.INSTALLED_APPS
 
         # We have to load these apps to test staticfiles.
         load_app('regressiontests.staticfiles_tests.apps.test')
@@ -50,6 +50,9 @@
             'django.contrib.staticfiles.finders.AppDirectoriesFinder',
             'django.contrib.staticfiles.finders.DefaultStorageFinder',
         )
+        settings.INSTALLED_APPS = [
+            "regressiontests.staticfiles_tests",
+        ]
 
     def tearDown(self):
         settings.DEBUG = self.old_debug
@@ -98,7 +101,11 @@
     def _get_file(self, filepath):
         assert filepath, 'filepath is empty.'
         filepath = os.path.join(settings.STATICFILES_ROOT, filepath)
-        return open(filepath).read()
+        f = open(filepath)
+        try:
+            return f.read()
+        finally:
+            f.close()
 
 
 class TestDefaults(object):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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.

Reply via email to