summaryrefslogtreecommitdiff
path: root/tests/i18n
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2021-06-30 14:15:25 +0200
committerCarlton Gibson <carlton@noumenal.es>2021-07-01 10:11:10 +0200
commit4af162d4de5d60cef42e4707d821c1d6c0c99be0 (patch)
treeccf8f81e20f2005670f5186dfeb703db796fe549 /tests/i18n
parentdfa7781033a0d62e84c632ef216208d29e7633c8 (diff)
Refs #32144 -- Made makemessages remove temporary files on preprocessing error.
Co-authored-by: Anders Hovmöller <anders.hovmoller@dryft.se>
Diffstat (limited to 'tests/i18n')
-rw-r--r--tests/i18n/commands/templates/template_0_with_no_error.tpl6
-rw-r--r--tests/i18n/test_extraction.py3
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/i18n/commands/templates/template_0_with_no_error.tpl b/tests/i18n/commands/templates/template_0_with_no_error.tpl
new file mode 100644
index 0000000000..8abd38e603
--- /dev/null
+++ b/tests/i18n/commands/templates/template_0_with_no_error.tpl
@@ -0,0 +1,6 @@
+{% load i18n %}
+{% blocktranslate %}Hello{% endblocktranslate %}
+
+This file has a name that should be lexicographically before
+'template_with_error.tpl' so that we can test the cleanup case
+of the first file being successful, but the second failing.
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py
index 3ba371f66c..124d35313f 100644
--- a/tests/i18n/test_extraction.py
+++ b/tests/i18n/test_extraction.py
@@ -226,8 +226,9 @@ class BasicExtractorTests(ExtractorTests):
)
with self.assertRaisesMessage(SyntaxError, msg):
management.call_command('makemessages', locale=[LOCALE], extensions=['tpl'], verbosity=0)
- # The temporary file was cleaned up
+ # The temporary files were cleaned up.
self.assertFalse(os.path.exists('./templates/template_with_error.tpl.py'))
+ self.assertFalse(os.path.exists('./templates/template_0_with_no_error.tpl.py'))
def test_unicode_decode_error(self):
shutil.copyfile('./not_utf8.sample', './not_utf8.txt')