diff options
| author | Julien Phalip <jphalip@gmail.com> | 2011-11-11 13:07:14 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2011-11-11 13:07:14 +0000 |
| commit | c3df840c20cc17ceb8fdcafb4215a6f3fb87fed1 (patch) | |
| tree | 11c951a19c328a9843e03d4970c9173223b97022 /tests | |
| parent | 9d410ee64b1a0f2d8a714eeffa7e17e09965f01c (diff) | |
Fixed #16903 -- Added `--no-location` option to the `makemessages` command to not write '#: filename:line' comment lines in language files. Thanks to alpar for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 17 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/tests.py | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index c49577221e..fb612a3a42 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -214,3 +214,20 @@ class NoWrapExtractorTests(ExtractorTests): self.assertTrue(os.path.exists(self.PO_FILE)) po_contents = open(self.PO_FILE, 'r').read() self.assertMsgId('""\n"This literal should also be included wrapped or not wrapped depending on the "\n"use of the --no-wrap option."', po_contents, use_quotes=False) + + +class NoLocationExtractorTests(ExtractorTests): + + def test_no_location_enabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, no_location=True) + self.assertTrue(os.path.exists(self.PO_FILE)) + po_contents = open(self.PO_FILE, 'r').read() + self.assertFalse('#: templates/test.html:55' in po_contents) + + def test_no_location_disabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, no_location=False) + self.assertTrue(os.path.exists(self.PO_FILE)) + po_contents = open(self.PO_FILE, 'r').read() + self.assertTrue('#: templates/test.html:55' in po_contents) diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py index 17395ffb24..cefb6b1819 100644 --- a/tests/regressiontests/i18n/tests.py +++ b/tests/regressiontests/i18n/tests.py @@ -28,7 +28,8 @@ from .commands.tests import can_run_extraction_tests, can_run_compilation_tests if can_run_extraction_tests: from .commands.extraction import (ExtractorTests, BasicExtractorTests, JavascriptExtractorTests, IgnoredExtractorTests, SymlinkExtractorTests, - CopyPluralFormsExtractorTests, NoWrapExtractorTests) + CopyPluralFormsExtractorTests, NoWrapExtractorTests, + NoLocationExtractorTests) if can_run_compilation_tests: from .commands.compilation import MessageCompilationTests, PoFileTests from .contenttypes.tests import ContentTypeTests |
