diff --git a/tests/regressiontests/i18n/test_warnings.py b/tests/regressiontests/i18n/test_warnings.py index 519749252f..d9899c10b1 100644 --- a/tests/regressiontests/i18n/test_warnings.py +++ b/tests/regressiontests/i18n/test_warnings.py @@ -20,11 +20,22 @@ class DeprecationWarningTests(TestCase): settings.SETTINGS_MODULE = self.old_settings_module settings.LOCALE_PATHS = self.old_locale_paths + def test_warn_if_project_has_locale_subdir(self): + """Test that PendingDeprecationWarning is generated when a deprecated project level locale/ subdir is present.""" + project_path = join(dirname(abspath(__file__)), '..') + warnings.filterwarnings('error', + "Translations in the project directory aren't supported anymore\. Use the LOCALE_PATHS setting instead\.", + PendingDeprecationWarning) + reload(django.utils.translation) + self.assertRaises(PendingDeprecationWarning, django.utils.translation.ugettext, 'Time') + def test_no_warn_if_project_and_locale_paths_overlap(self): """Test that PendingDeprecationWarning isn't generated when a deprecated project level locale/ subdir is also included in LOCALE_PATHS.""" project_path = join(dirname(abspath(__file__)), '..') settings.LOCALE_PATHS += (normpath(join(project_path, 'locale')),) - warnings.filterwarnings('error', "Translations in the project directory aren't supported anymore\. Use the LOCALE_PATHS setting instead\.", PendingDeprecationWarning) + warnings.filterwarnings('error', + "Translations in the project directory aren't supported anymore\. Use the LOCALE_PATHS setting instead\.", + PendingDeprecationWarning) reload(django.utils.translation) try: django.utils.translation.ugettext('Time')