diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-01-16 15:36:22 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-01-16 20:29:06 -0300 |
| commit | eee865257aaa9005947a7b4994c475c2ad59d698 (patch) | |
| tree | 3347b277bf9c53c73facc5b50d9ea075ac4954fa /tests | |
| parent | d406afe12edcedbaf745225713ebf3e36fa776fc (diff) | |
Fixed #17008 -- Added makemessages option to not remove .pot files.
Thanks airstrike for the report and initial patch, Julien for an
enhanced patch and Jannis for reviewing.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 33 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/tests.py | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index aa5efe1967..bd2b84a952 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -293,3 +293,36 @@ class NoLocationExtractorTests(ExtractorTests): with open(self.PO_FILE, 'r') as fp: po_contents = force_text(fp.read()) self.assertTrue('#: templates/test.html:55' in po_contents) + + +class KeepPotFileExtractorTests(ExtractorTests): + + def setUp(self): + self.POT_FILE = self.PO_FILE + 't' + super(KeepPotFileExtractorTests, self).setUp() + + def tearDown(self): + super(KeepPotFileExtractorTests, self).tearDown() + os.chdir(self.test_dir) + try: + os.unlink(self.POT_FILE) + except OSError: + pass + os.chdir(self._cwd) + + def test_keep_pot_disabled_by_default(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0) + self.assertFalse(os.path.exists(self.POT_FILE)) + + def test_keep_pot_explicitly_disabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, + keep_pot=False) + self.assertFalse(os.path.exists(self.POT_FILE)) + + def test_keep_pot_enabled(self): + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, + keep_pot=True) + self.assertTrue(os.path.exists(self.POT_FILE)) diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py index 44d84f9143..5d789b4acb 100644 --- a/tests/regressiontests/i18n/tests.py +++ b/tests/regressiontests/i18n/tests.py @@ -32,7 +32,7 @@ if can_run_extraction_tests: from .commands.extraction import (ExtractorTests, BasicExtractorTests, JavascriptExtractorTests, IgnoredExtractorTests, SymlinkExtractorTests, CopyPluralFormsExtractorTests, NoWrapExtractorTests, - NoLocationExtractorTests) + NoLocationExtractorTests, KeepPotFileExtractorTests) if can_run_compilation_tests: from .commands.compilation import (PoFileTests, PoFileContentsTests, PercentRenderingTests) |
