diff options
| author | Claude Paroz <claude@2xlibre.net> | 2020-06-19 10:26:26 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-22 08:44:16 +0200 |
| commit | e62d55a4fe6555d18eebda638de402447618b500 (patch) | |
| tree | dc1da4ea8e2f1633ccc35bc988dfdaa75936458e /tests | |
| parent | ed0a040773f5bad187170ab4e3b094fe3108d702 (diff) | |
Fixed #31692 -- Prevented unneeded .po file compilation.
Thanks Nick Pope and Simon Charette for the reviews.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/test_compilation.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py index fbacaee221..791c1d4f15 100644 --- a/tests/i18n/test_compilation.py +++ b/tests/i18n/test_compilation.py @@ -49,6 +49,8 @@ class PoFileTests(MessageCompilationTests): # Put file in read-only mode. old_mode = mo_file_en.stat().st_mode mo_file_en.chmod(stat.S_IREAD) + # Ensure .po file is more recent than .mo file. + mo_file_en.with_suffix('.po').touch() try: with self.assertRaisesMessage(CommandError, 'compilemessages generated one or more errors.'): call_command('compilemessages', locale=['en'], stderr=err_buffer, verbosity=0) @@ -56,6 +58,14 @@ class PoFileTests(MessageCompilationTests): finally: mo_file_en.chmod(old_mode) + def test_no_compile_when_unneeded(self): + mo_file_en = Path(self.MO_FILE_EN) + mo_file_en.touch() + stdout = StringIO() + call_command('compilemessages', locale=['en'], stdout=stdout, verbosity=1) + msg = '%s” is already compiled and up to date.' % mo_file_en.with_suffix('.po') + self.assertIn(msg, stdout.getvalue()) + class PoFileContentsTests(MessageCompilationTests): # Ticket #11240 |
