|
@@ -5,12 +5,14 @@ import io
|
|
import os
|
|
import os
|
|
import re
|
|
import re
|
|
import shutil
|
|
import shutil
|
|
|
|
+import sys
|
|
import time
|
|
import time
|
|
from unittest import SkipTest, skipUnless
|
|
from unittest import SkipTest, skipUnless
|
|
import warnings
|
|
import warnings
|
|
|
|
|
|
from django.conf import settings
|
|
from django.conf import settings
|
|
from django.core import management
|
|
from django.core import management
|
|
|
|
+from django.core.management import execute_from_command_line
|
|
from django.core.management.utils import find_command
|
|
from django.core.management.utils import find_command
|
|
from django.test import SimpleTestCase
|
|
from django.test import SimpleTestCase
|
|
from django.test import override_settings
|
|
from django.test import override_settings
|
|
@@ -565,6 +567,17 @@ class ExcludedLocaleExtractionTests(ExtractorTests):
|
|
self._set_times_for_all_po_files()
|
|
self._set_times_for_all_po_files()
|
|
self.addCleanup(self._rmrf, os.path.join(self.test_dir, 'locale'))
|
|
self.addCleanup(self._rmrf, os.path.join(self.test_dir, 'locale'))
|
|
|
|
|
|
|
|
+ def test_command_help(self):
|
|
|
|
+ old_stdout, old_stderr = sys.stdout, sys.stderr
|
|
|
|
+ sys.stdout, sys.stderr = StringIO(), StringIO()
|
|
|
|
+ try:
|
|
|
|
+ # `call_command` bypasses the parser; by calling
|
|
|
|
+ # `execute_from_command_line` with the help subcommand we
|
|
|
|
+ # ensure that there are no issues with the parser itself.
|
|
|
|
+ execute_from_command_line(['django-admin', 'help', 'makemessages'])
|
|
|
|
+ finally:
|
|
|
|
+ sys.stdout, sys.stderr = old_stdout, old_stderr
|
|
|
|
+
|
|
def test_one_locale_excluded(self):
|
|
def test_one_locale_excluded(self):
|
|
management.call_command('makemessages', exclude=['it'], stdout=StringIO())
|
|
management.call_command('makemessages', exclude=['it'], stdout=StringIO())
|
|
self.assertRecentlyModified(self.PO_FILE % 'en')
|
|
self.assertRecentlyModified(self.PO_FILE % 'en')
|