diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-30 04:24:24 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2010-10-30 04:24:24 +0000 |
| commit | bc6d7d21023bfdd1dd73ac1ceb370fc18a4d241f (patch) | |
| tree | 8a5853a012e7e5344da326faf6d9eebfb1cbe886 /tests | |
| parent | ccc49029b8d84cf3eaaa3593df6370329f7b14e1 (diff) | |
Sped up the staticfiles_tests by allowing them to only search a few relevant directories, rather than every single test application.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14396 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/staticfiles_tests/tests.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py index 316b9c4cae..6999b7af30 100644 --- a/tests/regressiontests/staticfiles_tests/tests.py +++ b/tests/regressiontests/staticfiles_tests/tests.py @@ -26,11 +26,11 @@ class StaticFilesTestCase(TestCase): 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 @@ class StaticFilesTestCase(TestCase): '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 @@ class BuildStaticTestCase(StaticFilesTestCase): 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): |
