mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Dropped safeguards against very old versions of gettext.
gettext 0.19 was released in 2014.
This commit is contained in:
@@ -8,7 +8,6 @@ from subprocess import run
|
||||
from unittest import mock
|
||||
|
||||
from django.core.management import CommandError, call_command, execute_from_command_line
|
||||
from django.core.management.commands.makemessages import Command as MakeMessagesCommand
|
||||
from django.core.management.utils import find_command
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test.utils import captured_stderr, captured_stdout
|
||||
@@ -269,9 +268,6 @@ class CompilationErrorHandling(MessageCompilationTests):
|
||||
"django.core.management.utils.run",
|
||||
lambda *args, **kwargs: run(*args, env=env, **kwargs),
|
||||
):
|
||||
cmd = MakeMessagesCommand()
|
||||
if cmd.gettext_version < (0, 18, 3):
|
||||
self.skipTest("python-brace-format is a recent gettext addition.")
|
||||
stderr = StringIO()
|
||||
with self.assertRaisesMessage(
|
||||
CommandError, "compilemessages generated one or more errors"
|
||||
|
||||
@@ -6,7 +6,7 @@ import time
|
||||
import warnings
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from unittest import mock, skipIf, skipUnless
|
||||
from unittest import mock, skipUnless
|
||||
|
||||
from admin_scripts.tests import AdminScriptTestCase
|
||||
|
||||
@@ -25,10 +25,6 @@ from .utils import POFileAssertionMixin, RunInTmpDirMixin, copytree
|
||||
|
||||
LOCALE = "de"
|
||||
has_xgettext = find_command("xgettext")
|
||||
gettext_version = MakeMessagesCommand().gettext_version if has_xgettext else None
|
||||
requires_gettext_019 = skipIf(
|
||||
has_xgettext and gettext_version < (0, 19), "gettext 0.19 required"
|
||||
)
|
||||
|
||||
|
||||
@skipUnless(has_xgettext, "xgettext is mandatory for extraction tests")
|
||||
@@ -836,7 +832,6 @@ class LocationCommentsTests(ExtractorTests):
|
||||
self.assertLocationCommentNotPresent(self.PO_FILE, None, ".html.py")
|
||||
self.assertLocationCommentPresent(self.PO_FILE, 5, "templates", "test.html")
|
||||
|
||||
@requires_gettext_019
|
||||
def test_add_location_full(self):
|
||||
"""makemessages --add-location=full"""
|
||||
management.call_command(
|
||||
@@ -848,7 +843,6 @@ class LocationCommentsTests(ExtractorTests):
|
||||
self.PO_FILE, "Translatable literal #6b", "templates", "test.html"
|
||||
)
|
||||
|
||||
@requires_gettext_019
|
||||
def test_add_location_file(self):
|
||||
"""makemessages --add-location=file"""
|
||||
management.call_command(
|
||||
@@ -862,7 +856,6 @@ class LocationCommentsTests(ExtractorTests):
|
||||
self.PO_FILE, "Translatable literal #6b", "templates", "test.html"
|
||||
)
|
||||
|
||||
@requires_gettext_019
|
||||
def test_add_location_never(self):
|
||||
"""makemessages --add-location=never"""
|
||||
management.call_command(
|
||||
@@ -871,24 +864,6 @@ class LocationCommentsTests(ExtractorTests):
|
||||
self.assertTrue(os.path.exists(self.PO_FILE))
|
||||
self.assertLocationCommentNotPresent(self.PO_FILE, None, "test.html")
|
||||
|
||||
@mock.patch(
|
||||
"django.core.management.commands.makemessages.Command.gettext_version",
|
||||
new=(0, 18, 99),
|
||||
)
|
||||
def test_add_location_gettext_version_check(self):
|
||||
"""
|
||||
CommandError is raised when using makemessages --add-location with
|
||||
gettext < 0.19.
|
||||
"""
|
||||
msg = (
|
||||
"The --add-location option requires gettext 0.19 or later. You have "
|
||||
"0.18.99."
|
||||
)
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
management.call_command(
|
||||
"makemessages", locale=[LOCALE], verbosity=0, add_location="full"
|
||||
)
|
||||
|
||||
|
||||
class NoObsoleteExtractorTests(ExtractorTests):
|
||||
work_subdir = "obsolete_translations"
|
||||
|
||||
Reference in New Issue
Block a user