summaryrefslogtreecommitdiff
path: root/tests/i18n
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2021-06-30 14:09:20 +0200
committerCarlton Gibson <carlton@noumenal.es>2021-07-01 10:11:10 +0200
commitdfa7781033a0d62e84c632ef216208d29e7633c8 (patch)
tree57789b8dd44bf0cbdbd4464a24d009c472f380ff /tests/i18n
parent8feb2a49fa37528823cc900bbd9609319738193e (diff)
downloaddjango-dfa7781033a0d62e84c632ef216208d29e7633c8.tar.gz
Fixed #32144 -- Made makemessages remove temporary files when locale path doesn't exist.
Diffstat (limited to 'tests/i18n')
-rw-r--r--tests/i18n/project_dir/app_no_locale/test.html4
-rw-r--r--tests/i18n/test_extraction.py2
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/i18n/project_dir/app_no_locale/test.html b/tests/i18n/project_dir/app_no_locale/test.html
new file mode 100644
index 0000000000..1caebc9e15
--- /dev/null
+++ b/tests/i18n/project_dir/app_no_locale/test.html
@@ -0,0 +1,4 @@
+A non-Python file will be classed as translatable.
+
+The temporary file created from this should be removed from the file system if
+an error is raised.
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py
index d6f0e861b0..3ba371f66c 100644
--- a/tests/i18n/test_extraction.py
+++ b/tests/i18n/test_extraction.py
@@ -765,6 +765,8 @@ class CustomLayoutExtractionTests(ExtractorTests):
)
with self.assertRaisesMessage(management.CommandError, msg):
management.call_command('makemessages', locale=[LOCALE], verbosity=0)
+ # Working files are cleaned up on an error.
+ self.assertFalse(os.path.exists('./app_no_locale/test.html.py'))
def test_project_locale_paths(self):
self._test_project_locale_paths(os.path.join(self.test_dir, 'project_locale'))