Commit eaf17475 authored by Ramiro Morales's avatar Ramiro Morales
Browse files

Added a test for the PendingDeprecationWarning introduced in r15441. Refs #14924, #15286.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 179fefcf
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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')