mirror of
https://github.com/django/django.git
synced 2025-12-15 21:45:20 +00:00
Expurged INSTALLED_APPS from code and tests.
Except the app cache code and a few specific tests, of course.
This commit is contained in:
parent
9cdf1f6d54
commit
2239081ff1
5 changed files with 33 additions and 35 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue