summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-19 22:33:46 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-22 11:39:18 +0100
commit2239081ff16aab1eaafea003433f7139bf13e097 (patch)
tree373ddb3cf271c77d8baf0e4fd22fcc9f0d5f4d92 /tests/utils_tests
parent9cdf1f6d547b6dffcee26f0a525429452551bb4a (diff)
Expurged INSTALLED_APPS from code and tests.
Except the app cache code and a few specific tests, of course.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_autoreload.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
index d6e22ad8ee..47c70fae92 100644
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -2,6 +2,7 @@ import os
from django import conf
from django.contrib import admin
+from django.core.apps import app_cache
from django.test import TestCase, override_settings
from django.utils.autoreload import gen_filenames
@@ -27,7 +28,6 @@ class TestFilenameGenerator(TestCase):
self.assertIn(os.path.join(LOCALE_PATH, 'nl', 'LC_MESSAGES', 'django.mo'),
filenames)
- @override_settings(INSTALLED_APPS=())
def test_project_root_locale(self):
"""
Test that gen_filenames also yields from the current directory (project
@@ -36,19 +36,22 @@ class TestFilenameGenerator(TestCase):
old_cwd = os.getcwd()
os.chdir(os.path.dirname(__file__))
try:
- filenames = list(gen_filenames())
+ # Remove the current app from the app cache to guarantee that the
+ # files will be found thanks to the current working directory.
+ with app_cache._empty():
+ filenames = list(gen_filenames())
self.assertIn(
os.path.join(LOCALE_PATH, 'nl', 'LC_MESSAGES', 'django.mo'),
filenames)
finally:
os.chdir(old_cwd)
- @override_settings(INSTALLED_APPS=('django.contrib.admin',))
def test_app_locales(self):
"""
- Test that gen_filenames also yields from INSTALLED_APPS locales.
+ Test that gen_filenames also yields from locale dirs in installed apps.
"""
- filenames = list(gen_filenames())
+ with app_cache._empty(), app_cache._with_app('django.contrib.admin'):
+ filenames = list(gen_filenames())
self.assertIn(os.path.join(os.path.dirname(admin.__file__), 'locale',
'nl', 'LC_MESSAGES', 'django.mo'),
filenames)