summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-07-18 18:34:13 +0200
committerClaude Paroz <claude@2xlibre.net>2012-07-18 20:43:35 +0200
commitc54905b3597545dbe1a6d8cd0a60186bccf8b3e7 (patch)
tree1de08f7f000e0d0ab36a7f2bedac2e26647543e8 /tests
parentd8e221db90294e0f26ee41ef81a1466907ca201d (diff)
Fixed #18479 -- Stopped makemessages raising error on gettext warnings
Thanks Niels Busch for the initial patch.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/i18n/commands/code.sample4
-rw-r--r--tests/regressiontests/i18n/commands/extraction.py8
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/i18n/commands/code.sample b/tests/regressiontests/i18n/commands/code.sample
new file mode 100644
index 0000000000..bbcb83164b
--- /dev/null
+++ b/tests/regressiontests/i18n/commands/code.sample
@@ -0,0 +1,4 @@
+from django.utils.translation import ugettext
+
+# This will generate an xgettext warning
+my_string = ugettext("This string contain two placeholders: %s and %s" % ('a', 'b'))
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
index fb9ca4ed08..cd6d50893a 100644
--- a/tests/regressiontests/i18n/commands/extraction.py
+++ b/tests/regressiontests/i18n/commands/extraction.py
@@ -117,6 +117,14 @@ class BasicExtractorTests(ExtractorTests):
# Check that the temporary file was cleaned up
self.assertFalse(os.path.exists('./templates/template_with_error.html.py'))
+ def test_extraction_warning(self):
+ os.chdir(self.test_dir)
+ shutil.copyfile('./code.sample', './code_sample.py')
+ stdout = StringIO()
+ management.call_command('makemessages', locale=LOCALE, stdout=stdout)
+ os.remove('./code_sample.py')
+ self.assertIn("code_sample.py:4", stdout.getvalue())
+
def test_template_message_context_extractor(self):
"""
Ensure that message contexts are correctly extracted for the