def test_app_locales(self): """ Test that gen_filenames also yields from locale dirs in installed apps. """ 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)
def test_project_root_locale(self): """ Test that gen_filenames also yields from the current directory (project root). """ old_cwd = os.getcwd() os.chdir(os.path.dirname(__file__)) try: # 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)