diff options
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/test_autoreload.py | 13 |
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) |
